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

DEPR: Indexers will warn FutureWarning when used with a scalar indexer this is floating-point (GH4892) #6853

Merged
merged 1 commit into from
Apr 11, 2014

Conversation

jreback
Copy link
Contributor

@jreback jreback commented Apr 9, 2014

closes #4892

numpy is doing this i 1.9 IIRC, and Scipy already did it. in 0.13.3

Indexers will warn FutureWarning when used with a scalar indexer and a non-floating point Index

# non-floating point indexes can only be indexed by integers / labels
In [1]: Series(1,np.arange(5))[3.0]
        pandas/core/index.py:469: FutureWarning: scalar indexers should not be floating point unless a    floating index
Out[1]: 1

In [5]: Series(1,np.arange(5)).iloc[3.0]
        pandas/core/index.py:463: FutureWarning: scalar indexers should not be floating point unless a floating index
Out[5]: 1

# these are Float64Indexes, so integer or floating point is acceptable
In [3]: Series(1,np.arange(5.))[3]
Out[3]: 1

In [4]: Series(1,np.arange(5.))[3.0]
Out[4]: 1

@jreback jreback added this to the 0.14.0 milestone Apr 9, 2014
@jtratner
Copy link
Contributor

jtratner commented Apr 9, 2014

I know what you mean, but this error message is a little impenetrable.
Maybe we should say: FutureWarning: scalar indexers for {klass} should be
int and not float.

And fill in klass with the index type.

@jreback
Copy link
Contributor Author

jreback commented Apr 9, 2014

ok...sure!

I think that ALL warnings should purposely be as confusing as possible!

@jtratner
Copy link
Contributor

jtratner commented Apr 9, 2014

Haha

@jreback
Copy link
Contributor Author

jreback commented Apr 9, 2014

In [2]: Series(1,np.arange(5)).iloc[3.0]
pandas/core/index.py:463: FutureWarning: scalar indexers for index type Int64Index should be integers and not floating point

jreback added a commit that referenced this pull request Apr 11, 2014
DEPR: Indexers will warn FutureWarning when used with a scalar indexer this is floating-point (GH4892)
@jreback jreback merged commit 31ab9ce into pandas-dev:master Apr 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Dtype Conversions Unexpected or buggy dtype conversions Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DEPR: deprecate float keys in non-float indexers
2 participants