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

Enhancement: Add dropna to Float64Index #6194

Closed
michaelaye opened this issue Jan 30, 2014 · 5 comments
Closed

Enhancement: Add dropna to Float64Index #6194

michaelaye opened this issue Jan 30, 2014 · 5 comments
Labels
API Design Dtype Conversions Unexpected or buggy dtype conversions Enhancement Indexing Related to indexing on series/frames, not to indexes themselves

Comments

@michaelaye
Copy link
Contributor

AttributeError: 'Float64Index' object has no attribute 'dropna'

Any reason why it could not have a dropna()?

@jreback
Copy link
Contributor

jreback commented Jan 30, 2014

it could

keep in mind that the indexing code for Nan's is really hairy - so maybe a good idea!

@michaelaye
Copy link
Contributor Author

yeah, this was the result of prematurely making something the index while I should have dropped the NaNs before assigning it as an index. So maybe it's better to teach the user to prevent NaNs in the index? Possibly would avoid a lot of other issues.

@jreback
Copy link
Contributor

jreback commented Jan 30, 2014

the problem with nan in an index is that selection basically goes out the window and indexes are almost useless because since nan != nan and so ordering is shot

can you post a usecase?

what we maybe could do is have an index that has a fill value so that ordering / selection is maintained, but treat it as missing - just a thought

@michaelaye
Copy link
Contributor Author

i'm not sure i CAN defend a use case, now that I remember how bad NaNs are in the index?
As I said I had the following happening: dataframe with some columns having NaNs at the tail end. Creating a new dataframe with 2 columns of this dataframe without dropping NaNs. Assigning one of the new columns as an index to the new dataframe, ending up with NaNs in the index.
Maybe the real 'issue' here could be that I didn't notice? Maybe a warning would be appropriate if an array containing NaNs is made an Index?

@jreback
Copy link
Contributor

jreback commented Jan 31, 2014

no warning as setting an index possibly containing nan's is allowed. Its really the indexing of it that is the problem, which does raise an exception in some cases.

Their needs to be some more work in this area in any event. If you do find a case where nans are useful (or a nuiscance) in a Float64Index, pls post.

@jreback jreback modified the milestones: 0.15.0, 0.14.0 Feb 14, 2014
lexual added a commit to lexual/pandas that referenced this issue Jul 19, 2014
lexual added a commit to lexual/pandas that referenced this issue Jul 19, 2014
lexual added a commit to lexual/pandas that referenced this issue Aug 3, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015
qwhelan pushed a commit to qwhelan/pandas that referenced this issue Jul 28, 2015
@sinhrks sinhrks mentioned this issue Jul 25, 2016
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Dtype Conversions Unexpected or buggy dtype conversions Enhancement Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants