Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix fillna not to change index values. (#1241)
`DataFrame.fillna()` should not change the index values. ```py >>> import pandas as pd >>> import numpy as np >>> pdf = pd.DataFrame({'x': [np.nan, 2, 3, 4, np.nan, 6], ... 'y': [1, 2, np.nan, 4, np.nan, np.nan], ... 'z': [1, 2, 3, 4, np.nan, np.nan]}).set_index(['x', 'y']) >>> >>> pdf.fillna(-1) z x y NaN 1.0 1.0 2.0 2.0 2.0 3.0 NaN 3.0 4.0 4.0 4.0 NaN NaN -1.0 6.0 NaN -1.0 >>> pdf.fillna({'x': -1, 'y': -2, 'z': -5}) z x y NaN 1.0 1.0 2.0 2.0 2.0 3.0 NaN 3.0 4.0 4.0 4.0 NaN NaN -5.0 6.0 NaN -5.0 ``` whereas: ```py >>> ks.from_pandas(pdf).fillna(-1) z x y -1.0 1.0 1.0 2.0 2.0 2.0 3.0 -1.0 3.0 4.0 4.0 4.0 -1.0 -1.0 -1.0 6.0 -1.0 -1.0 >>> ks.from_pandas(pdf).fillna({'x': -1, 'y': -2, 'z': -5}) z x y -1.0 1.0 1.0 2.0 2.0 2.0 3.0 -2.0 3.0 4.0 4.0 4.0 -1.0 -2.0 -5.0 6.0 -2.0 -5.0 ```
- Loading branch information