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

SparseSeries.dropna() returns "NaN"s for values #730

Closed
rowanu opened this issue Feb 1, 2012 · 6 comments
Closed

SparseSeries.dropna() returns "NaN"s for values #730

rowanu opened this issue Feb 1, 2012 · 6 comments
Labels
Milestone

Comments

@rowanu
Copy link

rowanu commented Feb 1, 2012

A SparseSeries object I have called ".dropna()" on will output the indexes which are not NaN (which is correct), but shows "NaN" in the value column.

If I run SparseSeries.to_dense().dropna() I get the expected output ie. non-NaN indexes and their values.

@wesm
Copy link
Member

wesm commented Feb 1, 2012

Need to have a special implementation of dropna for SparseSeries. Need to decide what it should return-- a SparseSeries or a regular dense Series. The behavior might be different depending on what the fill_value is

@rowanu
Copy link
Author

rowanu commented Feb 1, 2012

My expectation would be a regular dense Series (consisting of only the indexes with values), but I have limited experience in these things.

If someone wanted a SparseSeries returned, why would they be running dropna() over it?

@wesm
Copy link
Member

wesm commented Feb 1, 2012

Suppose that you had fill_value=0 but had NAs in the non-zero values?

wesm added a commit that referenced this issue Feb 5, 2012
@wesm
Copy link
Member

wesm commented Feb 5, 2012

I fixed this up in git master. Will be part of 0.7.0 final

@wesm wesm closed this as completed Feb 5, 2012
@rowanu
Copy link
Author

rowanu commented Feb 5, 2012

Great, thanks for that! What did you end up deciding to do about the return
type?

On Sat, Feb 4, 2012 at 11:07 PM, Wes McKinney <
reply@reply.github.com

wrote:

I fixed this up in git master. Will be part of 0.7.0 final


Reply to this email directly or view it on GitHub:
https://github.com/wesm/pandas/issues/730#issuecomment-3815481

@wesm
Copy link
Member

wesm commented Feb 5, 2012

When the fill_value is NaN it will return a dense Series. When it's non-NA it will return another SparseSeries. Somewhat "impure" but I think that will be the most useful behavior

dan-nadler pushed a commit to dan-nadler/pandas that referenced this issue Sep 23, 2019
pypandoc deprecated the old function and does not render correctly with RST anymore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants