Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
ENH: make Series.ptp() handle missing values #11163
Comments
|
absolutely. this should do want to do a pull-requests? |
jreback
added Missing-data Numeric
labels
Sep 21, 2015
jreback
added this to the
Next Major Release
milestone
Sep 21, 2015
jreback
added Difficulty Novice Effort Low
labels
Sep 21, 2015
|
Sure, I can work on this. It looks pretty straightforward, although I guess non-numeric columns will have to skipped over as |
|
Certainly OK to fix the NaN issue in But, I am a bit more hesitant on the second part, adding it to DataFrame. Some reasons: 1) we already have many methods, and personally I don't think |
|
I agree In that case, I'll just change |
ajcr commentedSep 21, 2015
Currently (in master),
Series.ptp()is just implemented usingnp.ptp()and so the method will returnnanfor any Series that has one or more missing values:It is simple to write
s.max() - s.min()instead, but theptp()result is surprising as most pandas methods are designed to handle missing data gracefully. I think most users would expect theptp()method to ignoreNaN.If there is any agreement as to whether
ptp()should be changed, I would like to work on a pull request!Extending the idea, it might be useful to have both
DataFrame.ptp()andgroupby.ptp()methods.For this example DataFrame...
...I would expect the following behaviour:
Again, if there is any consensus from the community on whether these additional methods should be added, I'd be happy to work on the pull request.