Skip to content

Describe() does not work properly on timedelta64 #6145

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

Closed
vfilimonov opened this issue Jan 28, 2014 · 1 comment · Fixed by #13769
Closed

Describe() does not work properly on timedelta64 #6145

vfilimonov opened this issue Jan 28, 2014 · 1 comment · Fixed by #13769
Labels
Bug Timedelta Timedelta data type
Milestone

Comments

@vfilimonov
Copy link
Contributor

When being described, series of timedelta64 resulted in misformatted output:

Test example:

xx = pd.DataFrame({'t1':pd.date_range('2010-01-01 00:00:00', freq='T', periods=10),
                   't2':pd.date_range('2010-01-01 00:00:00', freq='2T', periods=10)})
xx['dt'] = xx['t2']-xx['t1']
print xx

Then xx.dt.describe() returns:

>>> xx.dt.describe()
count                                     10
mean     0   00:04:30
dtype: timedelta64[ns]
std                              1.81659e+11
min      0   00:00:00
dtype: timedelta64[ns]
25%                 135000000000 nanoseconds
50%      0   00:04:30
dtype: timedelta64[ns]
75%                 405000000000 nanoseconds
max      0   00:09:00
dtype: timedelta64[ns]
Name: dt, dtype: object

Describe of datetime64 works fine:

>>> xx.t1.describe()
count                      10
unique                     10
first     2010-01-01 00:00:00
last      2010-01-01 00:09:00
top       2010-01-01 00:00:00
freq                        1
Name: t1, dtype: object

Issue was found both in version 0.13.0 and master (0.13.0-417-g1ed5c3e).

@jreback
Copy link
Contributor

jreback commented Jan 28, 2014

this is actually quite tricky, because of the resulant object dtype and the fact that pandas doesn't have a wrapper for timedelta64 (like Timestamp is for datetime64); IOW, the objects are raw numpy dtypes.

@jreback jreback modified the milestones: 0.15.0, 0.14.0 Apr 9, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 3, 2015
@jreback jreback modified the milestones: 0.19.0, Next Major Release Jul 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants