Skip to content

Conversation

@drewmassey
Copy link

This extends the API - and there is a judgement call about how to treat nanosecond-resolution pd.Timedelta() objects in the context of datetime.timedelta() objects.

return "D"

@property
def resolution_timedelta(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The general idea was to have this new property return Timedelta(nanosecond=1) akin to how datetime.timedelta.resolution returns timedelta(microseconds=1)

""" return a string representing the lowest resolution that we have """
"""
Return a string representing the lowest resolution that we have.
Note that this is nonstandard behavior.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead, could you create a "See Also" section with the new method name, similar to this: https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.isin.html

def resolution(self):
""" return a string representing the lowest resolution that we have """
"""
Return a string representing the lowest resolution that we have.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of lowest resolution that we have, I think I'd be clearer if it was lowest resolution of the Timedelta instance

def resolution_timedelta(self):
"""
Return a timedelta object (rather than a string)
representing the lowest resolution we have.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of lowest resolution that we have, I think I'd be clearer if it was lowest resolution of the Timedelta class

"""
Return a timedelta object (rather than a string)
representing the lowest resolution we have.
to retrieve a string use the resolution property.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead, could you create a "See Also" section with the new method name, similar to this: https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.isin.html


- Tab completion on :class:`Index` in IPython no longer outputs deprecation warnings (:issue:`21125`)
- Bug preventing pandas being used on Windows without C++ redistributable installed (:issue:`21106`)
- Add `resolution_timedelta` to :class:`Timedelta` to get non-string representations of resolution (:issue: `21344`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move to v0.23.2.txt

@mroeschke mroeschke added Enhancement Timedelta Timedelta data type labels Jun 12, 2018
@mroeschke mroeschke added this to the 0.23.2 milestone Jun 12, 2018
@jreback jreback removed this from the 0.23.2 milestone Jun 13, 2018
@jreback
Copy link
Contributor

jreback commented Jun 13, 2018

Timedelta.resolution is used completely internally. rather have you change its name and leave .resolution as an inherited property. I didn't even know that timedelta has a property by this name.

This would then be an API change, but conform to timedelta, which we in general want to do.

@jreback
Copy link
Contributor

jreback commented Sep 25, 2018

can you rebase

@jreback
Copy link
Contributor

jreback commented Nov 23, 2018

closing as stale. if you'd like to continue, pls ping.

@jreback jreback closed this Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Timedelta Timedelta data type

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pd.Timedelta.resolution is different from datetime.timedelta.resolution

3 participants