koalas
koalas copied to clipboard
DataFrame reindex(fill_value) fails when containing NaNs
In pandas we have :
>>> pdf = pd.DataFrame({"numbers": [1.0, 2.0, None]}, index=['A', 'B', 'C'])
>>> pdf
numbers
A 1.0
B 2.0
C NaN
>>> pdf.reindex(index=["A", "C", "E"], fill_value=0).sort_index()
numbers
A 1.0
C NaN
E 0.0
But with koalas :
>>> kdf = ks.from_pandas(pdf)
>>> kdf.reindex(index=["A", "C", "E"], fill_value=0).sort_index()
numbers
A 1.0
C 0.0
E 0.0
All NaNs are replaced why only those inserted by new index values should be replaced.
Also, I think the parameter copy introduces an extra copy around line 7808.
One should copy here only if no copy was performed before.
I am working on this issue.