databricks / koalas

Koalas: pandas API on Apache Spark
Apache License 2.0
3.32k stars 356 forks source link

when using df.astype(str), the null value change to 'nan'? #2169

Closed RainFung closed 3 years ago

RainFung commented 3 years ago

when using df.astype(str), the null value change to 'nan'?

RainFung commented 3 years ago

Is there a way to keep null value ?

itholic commented 3 years ago

Could you give some more detail about the issue??

For me, the null values are changed to None, not nan as below?

>>> ks.DataFrame({"A": [1, 2, None], "B": ["a", "b", None], "C": [False, True, None]}).astype(str)
      A     B      C
0   1.0     a  false
1   2.0     b   true
2  None  None   None
RainFung commented 3 years ago

When I write the dataframe to database table, it raise nan .