Skip to content

BUG: dir(IntervalIndex()) raises #27571

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

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

BUG: dir(IntervalIndex()) raises #27571

ghost opened this issue Jul 24, 2019 · 4 comments · Fixed by #27653
Labels
Bug Interval Interval data type Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@ghost
Copy link

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

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

@jschendel jschendel added Bug Interval Interval data type labels Jul 24, 2019
@jschendel jschendel added this to the Contributions Welcome milestone Jul 24, 2019
@jbrockmendel
Copy link
Member

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

@vishwakftw
Copy link
Contributor

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
Copy link
Contributor

@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
@jorisvandenbossche jorisvandenbossche added the Regression Functionality that used to work in a prior pandas version label Jul 30, 2019
@jorisvandenbossche jorisvandenbossche modified the milestones: Contributions Welcome, 0.25.1 Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Interval Interval data type Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants