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

IntervalIndex constructor doesn't use dtype parameter #19262

Closed
jschendel opened this Issue Jan 16, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@jschendel
Member

jschendel commented Jan 16, 2018

Code Sample, a copy-pastable example if possible

The IntervalIndex constructor takes a dtype parameter but doesn't use it (no references to it in the code):

In [2]:  pd.IntervalIndex([pd.Interval(0, 1), pd.Interval(2, 3)], dtype='float64')
Out[2]:
IntervalIndex([(0, 1], (2, 3]]
              closed='right',
              dtype='interval[int64]')

The constructor methods do not support a dtype parameter:

In [3]: pd.IntervalIndex.from_intervals([pd.Interval(0, 1), pd.Interval(2, 3)], dtype='float64')
---------------------------------------------------------------------------
TypeError: from_intervals() got an unexpected keyword argument 'dtype'

In [4]: pd.IntervalIndex.from_arrays([0, 2], [1, 3], dtype='float64')
---------------------------------------------------------------------------
TypeError: from_arrays() got an unexpected keyword argument 'dtype'

In [5]: pd.IntervalIndex.from_breaks([0, 1, 2, 3], dtype='float64')
---------------------------------------------------------------------------
TypeError: from_breaks() got an unexpected keyword argument 'dtype'

In [6]: pd.IntervalIndex.from_tuples([(0, 1), (2, 3)], dtype='float64')
---------------------------------------------------------------------------
TypeError: from_tuples() got an unexpected keyword argument 'dtype'

Expected Output

I'd expect the IntervalIndex constructor and constructor methods to support a dtype parameter, which can be used to override the inferred dtype.

@jreback jreback added this to the Next Major Release milestone Jan 16, 2018

@jreback jreback modified the milestones: Next Major Release, 0.23.0 Jan 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment