Skip to content
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

BUG: dir(IntervalIndex()) raises #27571

Closed
pilkibun opened this issue Jul 24, 2019 · 4 comments · Fixed by #27653

Comments

@pilkibun
Copy link
Contributor

commented Jul 24, 2019

In [8]: ix=pd.IntervalIndex.from_breaks([0,1,2])
   ...: dir(ix)
...
ValueError: cannot infer type for <class 'NoneType'>
@jschendel

This comment has been minimized.

Copy link
Member

commented Jul 24, 2019

Thanks for the report @pilkibun! I can confirm this behavior. Interestingly, dir(pd.IntervalIndex) is fine, it's just a constructed IntervalIndex that fails.

@jbrockmendel

This comment has been minimized.

Copy link
Member

commented Jul 24, 2019

Looks like in it is calling ix.str and taht calls lib.infer_dtype which raises because its not looking at an ndarray

@vishwakftw

This comment has been minimized.

Copy link

commented Jul 26, 2019

I'm new to the project, but from a cursory glance of the documentation pd.IntervalIndex.from_breaks only accepts array-likes, and range(3) is not an array-like (based on pd.core.dtypes.inference.is_array_like.

So, isn't range(3) technically an incorrect input?

@TomAugspurger

This comment has been minimized.

Copy link
Contributor

commented Jul 29, 2019

@vishwakftw the docs for IntervalIndex.from_breaks should maybe be updated to require "list-like" rather than "array-like". I haven't looked closely.

That said, I think that's separate from the issue @pilkibun reported.

jbrockmendel added a commit to jbrockmendel/pandas that referenced this issue Jul 30, 2019
@jbrockmendel jbrockmendel referenced this issue Jul 30, 2019
5 of 5 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.