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

BUG: median() not correctly handling non-float null values (fixes #10… #10072

Merged
merged 1 commit into from
May 7, 2015

Conversation

mortada
Copy link
Contributor

@mortada mortada commented May 7, 2015

closes #10040

@mortada
Copy link
Contributor Author

mortada commented May 7, 2015

Note that the existing unit test is actually wrong

In [1]: from pandas import Series, Timestamp

In [2]: from datetime import timedelta

In [3]: s = Series([Timestamp('20130101') + timedelta(seconds=i*i) for i in range(10)])

In [4]: td = s.diff()

In [5]: td
Out[5]:
0        NaT
1   00:00:01
2   00:00:03
3   00:00:05
4   00:00:07
5   00:00:09
6   00:00:11
7   00:00:13
8   00:00:15
9   00:00:17
dtype: timedelta64[ns]

td.median() should really be 00:00:09 instead of 00:00:08 as it is currently asserting.

@jreback
Copy link
Contributor

jreback commented May 7, 2015

pls add a release note for 0.16.1

@jreback jreback added Bug Numeric Operations Arithmetic, Comparison, and Logical operations Timedelta Timedelta data type labels May 7, 2015
@jreback jreback added this to the 0.16.1 milestone May 7, 2015
@mortada
Copy link
Contributor Author

mortada commented May 7, 2015

@jreback it's updated

jreback added a commit that referenced this pull request May 7, 2015
BUG: median() not correctly handling non-float null values (fixes #10
@jreback jreback merged commit 9c99566 into pandas-dev:master May 7, 2015
@jreback
Copy link
Contributor

jreback commented May 7, 2015

ty!

side issue. I briefly looked it and it appears to work, but are there cases where precision drops are an issue? e.g. we have int64 converted to float64 which drops precision, but it DOES seem to work. if you can experiment and see (I don't have a good) example. If you find somethign pls file an issue.

@mortada
Copy link
Contributor Author

mortada commented May 7, 2015

sure I'll play with this and see if I can find examples where precisions become an issue. It does seem like it could be a problem.

@mortada mortada deleted the median_NaT branch May 7, 2015 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Numeric Operations Arithmetic, Comparison, and Logical operations Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Median returns odd value when applied to timedeltas
2 participants