Skip to content

Conversation

@machenity
Copy link
Contributor

@gfyoung gfyoung added Indexing Related to indexing on series/frames, not to indexes themselves Error Reporting Incorrect or improved errors from pandas MultiIndex labels Aug 15, 2018
@gfyoung
Copy link
Member

gfyoung commented Aug 15, 2018

@machenity : Good start! We're going to need tests and a whatsnew entry in 0.24.0.

@codecov
Copy link

codecov bot commented Aug 15, 2018

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #22357      +/-   ##
==========================================
+ Coverage   92.05%   92.05%   +<.01%     
==========================================
  Files         169      169              
  Lines       50724    50733       +9     
==========================================
+ Hits        46693    46702       +9     
  Misses       4031     4031
Flag Coverage Δ
#multiple 90.46% <100%> (ø) ⬆️
#single 42.24% <0%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/indexes/numeric.py 97.24% <100%> (ø) ⬆️
pandas/core/frame.py 97.25% <0%> (ø) ⬆️
pandas/core/dtypes/cast.py 88.58% <0%> (ø) ⬆️
pandas/core/internals/blocks.py 93.84% <0%> (+0.01%) ⬆️
pandas/core/arrays/integer.py 94.55% <0%> (+0.06%) ⬆️
pandas/core/dtypes/base.py 92.68% <0%> (+0.37%) ⬆️

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 83be235...dff350a. Read the comment docs.

@machenity
Copy link
Contributor Author

@gfyoung Do your 'tests' mean that i have to write new test case code or just be okay with those codecov test?

@scari
Copy link
Contributor

scari commented Aug 16, 2018

I believe @gfyoung meant a test for your change. Will you come to the PyCon KR sprint tomorrow?

@machenity
Copy link
Contributor Author

@scari Yes, i will, but i have a tutorial before that.

def get_loc(self, key, method=None, tolerance=None):
try:
if np.all(np.isnan(key)):
if np.all(np.isnan(key)) or isinstance(key, bool):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use is_bool here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does python have is_bool() function?
I used isinstance() to check if key is an instance of subclass of bool.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, I found it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pandas has all of these functions, which we consistently use. thanks

@machenity
Copy link
Contributor Author

@gfyoung I added tests and whatsnew changes and edit codes with help of @jreback. Thanks.

- Fixed ``DataFrame[np.nan]`` when columns are non-unique (:issue:`21428`)
- Bug when indexing :class:`DatetimeIndex` with nanosecond resolution dates and timezones (:issue:`11679`)
- Bug where indexing with a Numpy array containing negative values would mutate the indexer (:issue:`21867`)
- ``Float64Index.get_loc`` now raises KeyError when boolean key passed. (:issue:`19087`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double back-ticks on KeyError.

@jreback jreback added this to the 0.24.0 milestone Aug 20, 2018
@jreback
Copy link
Contributor

jreback commented Aug 20, 2018

lgtm. small change suggested by @gfyoung

@machenity
Copy link
Contributor Author

@gfyoung I edited it. Thank you for your suggestion.

@jreback jreback merged commit 27507a7 into pandas-dev:master Aug 22, 2018
@jreback
Copy link
Contributor

jreback commented Aug 22, 2018

thanks @machenity

Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Error Reporting Incorrect or improved errors from pandas Indexing Related to indexing on series/frames, not to indexes themselves MultiIndex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

index locators cast bool to float (and not to int)

4 participants