Skip to content

Commit

Permalink
add 'W'as a valid unit for Timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
natmokval committed Jun 17, 2024
1 parent dd87dd3 commit 46a56e8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ class Timestamp(_Timestamp):
Time zone for time which Timestamp will have.
unit : str
Unit used for conversion if ts_input is of type int or float. The
valid values are 'D', 'h', 'm', 's', 'ms', 'us', and 'ns'. For
valid values are 'W', 'D', 'h', 'm', 's', 'ms', 'us', and 'ns'. For
example, 's' means seconds and 'ms' means milliseconds.
For float inputs, the result will be stored in nanoseconds, and
Expand Down Expand Up @@ -1417,6 +1417,11 @@ class Timestamp(_Timestamp):
>>> pd.Timestamp(1513393355.5, unit='s')
Timestamp('2017-12-16 03:02:35.500000')
This converts an int representing a Unix-epoch in units of weeks
>>> pd.Timestamp(1535, unit='W')
Timestamp('1999-06-03 00:00:00')
This converts an int representing a Unix-epoch in units of seconds
and for a particular timezone
Expand Down

0 comments on commit 46a56e8

Please sign in to comment.