Skip to content

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

Closed
@pllim

Description

@pllim
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Output-Formatting__repr__ of pandas objects, to_stringTimedeltaTimedelta data type

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions