Skip to content

Commit b7970fc

Browse files
authored
DOC: update the documentation for Timestamp: add to parameters the missing unit 'W' and an example (#59033)
add 'W'as a valid unit for Timestamp
1 parent c2eb3da commit b7970fc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pandas/_libs/tslibs/timestamps.pyx

+6-1
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,7 @@ class Timestamp(_Timestamp):
13781378
Time zone for time which Timestamp will have.
13791379
unit : str
13801380
Unit used for conversion if ts_input is of type int or float. The
1381-
valid values are 'D', 'h', 'm', 's', 'ms', 'us', and 'ns'. For
1381+
valid values are 'W', 'D', 'h', 'm', 's', 'ms', 'us', and 'ns'. For
13821382
example, 's' means seconds and 'ms' means milliseconds.
13831383
13841384
For float inputs, the result will be stored in nanoseconds, and
@@ -1417,6 +1417,11 @@ class Timestamp(_Timestamp):
14171417
>>> pd.Timestamp(1513393355.5, unit='s')
14181418
Timestamp('2017-12-16 03:02:35.500000')
14191419
1420+
This converts an int representing a Unix-epoch in units of weeks
1421+
1422+
>>> pd.Timestamp(1535, unit='W')
1423+
Timestamp('1999-06-03 00:00:00')
1424+
14201425
This converts an int representing a Unix-epoch in units of seconds
14211426
and for a particular timezone
14221427

0 commit comments

Comments
 (0)