-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Support timespec argument in Timestamp.isoformat() #44397
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good a couple of questions.
pandas/_libs/tslibs/nattype.pyx
Outdated
------- | ||
str | ||
|
||
Examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this example should be for NaT (to be honest dont' need it here though)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem I ran into - there was a test failure because the docstrings differed between NaT and Timestamp, so that's why I copied the docstring into NaT. Do you have any advice about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right we have tests that confirm this, but since we are not explicitly making these differnt you can change the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so I ended up reverting the docstring change to NaT and updated the test to ignore the docstring changes with Timestamp.
(ts_no_ns, "seconds", "2019-05-18T15:17:08"), | ||
(ts_no_ns, "nanoseconds", "2019-05-18T15:17:08.132263000"), | ||
(ts_ns, "auto", "2019-05-18T15:17:08.132263123"), | ||
(ts_ns, "hours", "2019-05-18T15"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also run on NaT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure it made sense to run the same tests on NaT(?) but I did add a test to the NaT tests to check that it at least accepts the timespec
parameter.
thanks @swt2c lgtm. cc @mroeschke if any comments |
Great, thanks @swt2c |
…4397) * ENH: Support timespec argument in Timestamp.isoformat() * Get rid of tabs * Copy isoformat docstring to NaTType * Remove NaT docstring changes & update NaT tests * Fix another black issue
This is an update of PR #38550. I added support for "nanoseconds" as an argument, expanded the test cases, and addressed most of the comments in the original PR.