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
ghost opened this issue Jul 24, 2019 · 4 comments
Closed

BUG: dir(IntervalIndex()) raises #27571

ghost opened this issue Jul 24, 2019 · 4 comments

Comments

@ghost
Copy link

@ghost ghost commented Jul 24, 2019

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

@jschendel jschendel 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.

Loading

@jbrockmendel
Copy link
Member

@jbrockmendel jbrockmendel 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

Loading

@vishwakftw
Copy link
Contributor

@vishwakftw vishwakftw 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?

Loading

@TomAugspurger
Copy link
Contributor

@TomAugspurger TomAugspurger 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.

Loading

jbrockmendel added a commit to jbrockmendel/pandas that referenced this issue Jul 30, 2019
@jorisvandenbossche jorisvandenbossche removed this from the Contributions Welcome milestone Jul 30, 2019
@jorisvandenbossche jorisvandenbossche added this to the 0.25.1 milestone Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

5 participants