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

Discrepancy in DateOffset & Timedelta string representation #33094

Open
yohplala opened this issue Mar 28, 2020 · 0 comments
Open

Discrepancy in DateOffset & Timedelta string representation #33094

yohplala opened this issue Mar 28, 2020 · 0 comments
Labels
Bug Frequency DateOffsets Output-Formatting __repr__ of pandas objects, to_string Timedelta Timedelta data type

Comments

@yohplala
Copy link

yohplala commented Mar 28, 2020

Code Sample, a copy-pastable example if possible

# DateOffset creation and string representation
off = pd.tseries.frequencies.to_offset('2MS')
off.freqstr
>>> Out[20]: '2MS'

# Timedelta creation from DateOffset string representation
td = pd.to_timedelta(off.freqstr)
td
>>> Out[21] Timedelta('0 days 00:00:00.002000')

# Same for month end 'M'

Problem description

Hello
I am aware Timedelta & DateOffset objects are not supposed to have same representation, but could their string aliases be different when they cannot be mapped to each other?

For Timedelta / minute vs DateOffset / month start ('M'):

  • I understand that representations should be 'min' or 'T' so I am surprised 'M' is accepted by to_timedelta(). To be removed?

For DateOffset / month start vs Timedelta / millisecond ('MS'):

  • maybe month start can be replaced by MB 'Month Begin' ?

Would this make sense?
Bests,

@jbrockmendel jbrockmendel added Frequency DateOffsets Output-Formatting __repr__ of pandas objects, to_string Timedelta Timedelta data type labels May 16, 2020
@mroeschke mroeschke added the Bug label Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Frequency DateOffsets Output-Formatting __repr__ of pandas objects, to_string Timedelta Timedelta data type
Projects
None yet
Development

No branches or pull requests

3 participants