Skip to content

Conversation

@ueshin
Copy link
Collaborator

@ueshin ueshin commented Jan 30, 2020

Fix fillna to support partial column index for multi-index columns.
E.g.,

>>> import pandas as pd
>>> import numpy as np
>>> pdf = pd.DataFrame({('x', 'a'): [np.nan, 2, 3, 4, np.nan, 6],
...                     ('x', 'b'): [1, 2, np.nan, 4, np.nan, np.nan],
...                     ('y', 'c'): [1, 2, 3, 4, np.nan, np.nan]})
>>> pdf
     x         y
     a    b    c
0  NaN  1.0  1.0
1  2.0  2.0  2.0
2  3.0  NaN  3.0
3  4.0  4.0  4.0
4  NaN  NaN  NaN
5  6.0  NaN  NaN

>>> pdf.fillna({'x': -1})
     x         y
     a    b    c
0 -1.0  1.0  1.0
1  2.0  2.0  2.0
2  3.0 -1.0  3.0
3  4.0  4.0  4.0
4 -1.0 -1.0  NaN
5  6.0 -1.0  NaN

@ueshin ueshin requested a review from HyukjinKwon January 30, 2020 18:10
@codecov-io
Copy link

codecov-io commented Jan 30, 2020

Codecov Report

Merging #1244 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1244      +/-   ##
==========================================
+ Coverage   95.09%   95.09%   +<.01%     
==========================================
  Files          35       35              
  Lines        7154     7159       +5     
==========================================
+ Hits         6803     6808       +5     
  Misses        351      351
Impacted Files Coverage Δ
databricks/koalas/frame.py 96.84% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4bdfe2d...6faba3f. Read the comment docs.

@itholic
Copy link
Contributor

itholic commented Feb 1, 2020

Nice fixing! LGTM.

@HyukjinKwon HyukjinKwon merged commit 0e56ea4 into databricks:master Feb 3, 2020
@ueshin ueshin deleted the fillna branch February 4, 2020 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants