Skip to content

Question/bug: How to get rid of "0 days" in timedelta64[s] #35463

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
2 of 3 tasks
pllim opened this issue Jul 29, 2020 · 7 comments
Closed
2 of 3 tasks

Question/bug: How to get rid of "0 days" in timedelta64[s] #35463

pllim opened this issue Jul 29, 2020 · 7 comments
Labels
Output-Formatting __repr__ of pandas objects, to_string Timedelta Timedelta data type

Comments

@pllim
Copy link

pllim commented Jul 29, 2020

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas. -- I can't tell if this is a feature or a bug.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

>>> import pandas as pd
>>> import numpy as np
>>> dt = pd.Series(np.array([1, 300], dtype='timedelta64[s]')) 
>>> df = pd.DataFrame({'dt': dt})
>>> pd.__version__
'1.0.5'
>>> df
        dt
0 00:00:01
1 00:05:00
>>> pd.__version__
'1.1.0'
>>> df
               dt
0 0 days 00:00:01
1 0 days 00:05:00

Problem description

"0 days" started to appear when DataFrame contains timedelta64[s].

Expected Output

See "Code Sample" for pandas 1.0.5.

Output of pd.show_versions()

See "Code Sample" for pandas 1.1.0.

Further readings

astropy/astropy#10608 and astropy/astropy#10609

@pllim pllim added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 29, 2020
@simonjayhawkins
Copy link
Member

Thanks @pllim for the report. Not sure if this was an intentional change, so will mark as regression pending further investigation.

@simonjayhawkins simonjayhawkins added Output-Formatting __repr__ of pandas objects, to_string Regression Functionality that used to work in a prior pandas version Timedelta Timedelta data type and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 30, 2020
@simonjayhawkins simonjayhawkins added this to the 1.1.1 milestone Jul 30, 2020
@simonjayhawkins
Copy link
Member

It appears this was an intentional change, see tests changed in #33270

@simonjayhawkins simonjayhawkins removed the Regression Functionality that used to work in a prior pandas version label Jul 30, 2020
@simonjayhawkins simonjayhawkins removed this from the 1.1.1 milestone Jul 30, 2020
@pllim
Copy link
Author

pllim commented Jul 30, 2020

Wasn't expecting that in a minor release. Is there a way to get the old behavior back? If no, that's fine too, just want to know.

@simonjayhawkins
Copy link
Member

@jbrockmendel

@jreback
Copy link
Contributor

jreback commented Jul 30, 2020

Wasn't expecting that in a minor release. Is there a way to get the old behavior back? If no, that's fine too, just want to know.

minor release can and do have api changes - pls read the release notes

this was for conformity of timedelta outputs

@pllim
Copy link
Author

pllim commented Jul 30, 2020

I did glance at the notes but I guess I missed it. Okie dokie then.

@pllim pllim closed this as completed Jul 30, 2020
@pllim
Copy link
Author

pllim commented Jul 30, 2020

Thanks for digging into this, @simonjayhawkins !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Output-Formatting __repr__ of pandas objects, to_string Timedelta Timedelta data type
Projects
None yet
Development

No branches or pull requests

3 participants