-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed regression of Multi index with NaN #25424
Conversation
Codecov Report
@@ Coverage Diff @@
## master #25424 +/- ##
==========================================
- Coverage 91.25% 91.24% -0.01%
==========================================
Files 172 172
Lines 52973 53007 +34
==========================================
+ Hits 48338 48366 +28
- Misses 4635 4641 +6
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #25424 +/- ##
===========================================
- Coverage 91.73% 41.69% -50.05%
===========================================
Files 173 173
Lines 52856 52876 +20
===========================================
- Hits 48490 22048 -26442
- Misses 4366 30828 +26462
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are adding a significant amount of non trivial code here - which likely duplicates a fair amount of existing
likely this is change needs some work
@jreback |
Hello @hksonngan! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2019-03-14 21:47:12 UTC |
@hksonngan you are adding an amazing amount of complexity here. Please step thru the setting code; This is likely a very small change. |
@jreback I think one problem remains when set value multi-index with NaN, get_loc, will crash. I will investigate this. |
@jreback I add code to pass of the case when setting value with NaN index, but I don't know why I get a lot of linting errors when I rebase. I don't change these files. Do you know why? |
@jreback ping |
@hksonngan this is a massive amount of code. I am not even sure what you are trying to do your fix is VERY complicated. Please point out exactly where the issue is. |
@jreback if we have NaN in MultiIndex as: df = pd.DataFrame(
[
['A', np.nan, 1.23, 4.56],
['A', 'G', 1.32, 4.65],
['A', 'D', 9.87, 10.54],
],
columns=['pivot_0', 'pivot_1', 'col_1', 'col_2'],
)
df.set_index(['pivot_0', 'pivot_1'], inplace=True)
Now I set new
The right result is must |
Or I add new MultiIndex with NaN, I get exception like this code: df = pd.DataFrame(
[
['A', 'G', 1.32, 4.65],
['A', 'D', 9.87, 10.54],
],
columns=['pivot_0', 'pivot_1', 'col_1', 'col_2'],
)
df.set_index(['pivot_0', 'pivot_1'], inplace=True)
df.at[('A', np.nan), 'col_2'] = 0.0 # Get exception in here |
|
close as I will investigate another way to solve this |
git diff upstream/master -u -- "*.py" | flake8 --diff
As pull REF: codes-based MultiIndex engine #19074 changed compute of hashtable from
self.values
toself.codes
andself.levels
, NaN values doesn't cover.I just simply fixed this regression the special case, by check return value from the hashtable.