Skip to content

Adding unixtime property to Timestamp and DatetimeIndex #45217

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
wants to merge 9 commits into from

Conversation

fergalm
Copy link

@fergalm fergalm commented Jan 6, 2022

This PR implements #43975 (#43975), adding a unixtime property to Timestamp and Datetime index.

In the course of developing this PR, I discovered that the Timestamp class already has a method called timestamp() which calculates a unixtime. I deprecated the timestamp method, as I found the name ambiguous (there's nothing about the phrase timestamp that leads me to think of unixtimes).

This is my first PR against pandas, so apologies for any violations of conventions for code or PRs.

@pep8speaks
Copy link

pep8speaks commented Jan 6, 2022

Hello @fergalm! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-01-31 00:44:13 UTC

@@ -871,7 +886,13 @@ cdef class _Timestamp(ABCTimestamp):
"""
# GH 17329
# Note: Naive timestamps will not match datetime.stdlib
return round(self.value / 1e9, 6)
warnings.warn(
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a stdlib method and should remain

@jreback jreback added Enhancement Datetime Datetime data dtype labels Jan 8, 2022
"""
# GH 17329
# Note: Naive timestamps will not match datetime.stdlib
return round(self.value / 1e9, 6)
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this rounded?

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2022

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Mar 3, 2022
@jreback
Copy link
Contributor

jreback commented Mar 3, 2022

closing as stale. we would still take this if rebased & updated. pls ping to reopen if interested.

@jreback jreback closed this Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants