-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: improve pd.Timestamp docs with more examples and clarify differe… #18811
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
c5b149e
to
c6305b1
Compare
Codecov Report
@@ Coverage Diff @@
## master #18811 +/- ##
=========================================
Coverage ? 91.62%
=========================================
Files ? 154
Lines ? 51408
Branches ? 0
=========================================
Hits ? 47104
Misses ? 4304
Partials ? 0
Continue to review full report at Codecov.
|
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.
thanks, some comments.
pandas/_libs/tslibs/timestamps.pyx
Outdated
unit : string | ||
numpy unit used for conversion, if ts_input is int or float | ||
unit : str | ||
Unit used for conversion if ts_input is of type int or float. |
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.
let's add the valid values (D, h, m, s, ms us, ns)
pandas/_libs/tslibs/timestamps.pyx
Outdated
@@ -405,9 +406,19 @@ class Timestamp(_Timestamp): | |||
|
|||
Examples | |||
-------- | |||
Using the primary calling convention: | |||
|
|||
>>> pd.Timestamp('2017-01-01T12') | |||
Timestamp('2017-01-01 12:00:00') | |||
|
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 add some commentary before each of these examples
c6305b1
to
0781c26
Compare
@jreback updated, please take a look |
pandas/_libs/tslibs/timestamps.pyx
Outdated
>>> pd.Timestamp(1513393355, unit='s', tz='US/Pacific') | ||
Timestamp('2017-12-15 19:02:35-0800', tz='US/Pacific') | ||
|
||
Using the other two forms that minic the API for ``datetime.datetime``: |
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.
mimic
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.
good catch, will fix
@@ -405,9 +407,23 @@ class Timestamp(_Timestamp): | |||
|
|||
Examples | |||
-------- | |||
Using the primary calling convention: |
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.
do we use this nomenclature above? if not can you reconcile
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.
yes in the above the doc says:
Notes
-----
There are essentially three calling conventions for the constructor. The
primary form accepts four parameters. They can be passed by position or
keyword.
The other two forms mimic the parameters from ``datetime.datetime``. They
can be passed by either position or keyword, but not both mixed together.
…nt forms of API usage
0781c26
to
dcdf2ab
Compare
@jreback PR is updated |
thanks! |
…nt forms of API usage