You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
koalas appears to ignore None values when converting the type of a DataFrame or Series using .astype() instead of converting them which is the pandas behaviour. For instance when converting to str, in pandasNone becomes 'None' but this does not happen in koalas. Example below shown by using sorted() which can't handle None:
Example
importdatabricks.koalasasksimportpandasaspddata=pd.Series(['a', 'b', 'c', None])
sorted(data.astype(str).tolist())
# => ['None', 'a', 'b', 'c']data=ks.Series(['a', 'b', 'c', None])
sorted(data.astype(str).tolist())
# ---------------------------------------------------------------------------# TypeError Traceback (most recent call last)# <ipython-input-11-493f99e0fb6f> in <module># 1 data = ks.Series(['a', 'b', 'c', None])# ----> 2 sorted(data.astype(str).tolist())# # TypeError: '<' not supported between instances of 'NoneType' and 'str'
Is there a reason for this or can we bring this in line with pandas? Thanks
This should fix#1806
```python
>>> data = ks.Series(['a', 'b', 'c', None])
>>> sorted(data.astype(str).tolist())
['None', 'a', 'b', 'c']
```
For `DataFrame.astype` also works.
```python
>>> kdf
A B C
0 3 10.0 a
1 4 20.0 b
2 5 30.0 c
3 6 40.0 d
4 7 50.0 None
>>> sorted(kdf.astype(str).C.tolist())
['None', 'a', 'b', 'c', 'd']
```
koalas
appears to ignoreNone
values when converting the type of aDataFrame
orSeries
using.astype()
instead of converting them which is thepandas
behaviour. For instance when converting tostr
, inpandas
None
becomes'None'
but this does not happen inkoalas
. Example below shown by usingsorted()
which can't handleNone
:Example
Is there a reason for this or can we bring this in line with
pandas
? ThanksUbuntu 18.04
python 3.7.6
koalas==1.2.0
pandas==1.0.5
The text was updated successfully, but these errors were encountered: