@@ -369,7 +369,7 @@ cdef class _Timestamp(datetime):
369
369
class Timestamp (_Timestamp ):
370
370
""" Pandas replacement for datetime.datetime
371
371
372
- TimeStamp is the pandas equivalent of python's Datetime
372
+ Timestamp is the pandas equivalent of python's Datetime
373
373
and is interchangable with it in most cases. It's the type used
374
374
for the entries that make up a DatetimeIndex, and other timeseries
375
375
oriented data structures in pandas.
@@ -380,10 +380,12 @@ class Timestamp(_Timestamp):
380
380
Value to be converted to Timestamp
381
381
freq : str, DateOffset
382
382
Offset which Timestamp will have
383
- tz : string , pytz.timezone, dateutil.tz.tzfile or None
383
+ tz : str , pytz.timezone, dateutil.tz.tzfile or None
384
384
Time zone for time which Timestamp will have.
385
- unit : string
386
- numpy unit used for conversion, if ts_input is int or float
385
+ unit : str
386
+ Unit used for conversion if ts_input is of type int or float. The
387
+ valid values are 'D', 'h', 'm', 's', 'ms', 'us', and 'ns'. For
388
+ example, 's' means seconds and 'ms' means milliseconds.
387
389
offset : str, DateOffset
388
390
Deprecated, use freq
389
391
@@ -405,9 +407,23 @@ class Timestamp(_Timestamp):
405
407
406
408
Examples
407
409
--------
410
+ Using the primary calling convention:
411
+
412
+ This converts a datetime-like string
408
413
>>> pd.Timestamp('2017-01-01T12')
409
414
Timestamp('2017-01-01 12:00:00')
410
415
416
+ This converts a float representing a Unix epoch in units of seconds
417
+ >>> pd.Timestamp(1513393355.5, unit='s')
418
+ Timestamp('2017-12-16 03:02:35.500000')
419
+
420
+ This converts an int representing a Unix-epoch in units of seconds
421
+ and for a particular timezone
422
+ >>> pd.Timestamp(1513393355, unit='s', tz='US/Pacific')
423
+ Timestamp('2017-12-15 19:02:35-0800', tz='US/Pacific')
424
+
425
+ Using the other two forms that mimic the API for ``datetime.datetime``:
426
+
411
427
>>> pd.Timestamp(2017, 1, 1, 12)
412
428
Timestamp('2017-01-01 12:00:00')
413
429
@@ -429,7 +445,7 @@ class Timestamp(_Timestamp):
429
445
date corresponding to a proleptic Gregorian ordinal
430
446
freq : str, DateOffset
431
447
Offset which Timestamp will have
432
- tz : string , pytz.timezone, dateutil.tz.tzfile or None
448
+ tz : str , pytz.timezone, dateutil.tz.tzfile or None
433
449
Time zone for time which Timestamp will have.
434
450
offset : str, DateOffset
435
451
Deprecated, use freq
@@ -447,7 +463,7 @@ class Timestamp(_Timestamp):
447
463
448
464
Parameters
449
465
----------
450
- tz : string / timezone object, default None
466
+ tz : str or timezone object, default None
451
467
Timezone to localize to
452
468
"""
453
469
if is_string_object(tz):
@@ -465,7 +481,7 @@ class Timestamp(_Timestamp):
465
481
466
482
Parameters
467
483
----------
468
- tz : string / timezone object, default None
484
+ tz : str or timezone object, default None
469
485
Timezone to localize to
470
486
"""
471
487
return cls .now(tz)
@@ -774,7 +790,7 @@ class Timestamp(_Timestamp):
774
790
775
791
Parameters
776
792
----------
777
- tz : string , pytz.timezone, dateutil.tz.tzfile or None
793
+ tz : str , pytz.timezone, dateutil.tz.tzfile or None
778
794
Time zone for time which Timestamp will be converted to.
779
795
None will remove timezone holding local time.
780
796
@@ -828,7 +844,7 @@ class Timestamp(_Timestamp):
828
844
829
845
Parameters
830
846
----------
831
- tz : string , pytz.timezone, dateutil.tz.tzfile or None
847
+ tz : str , pytz.timezone, dateutil.tz.tzfile or None
832
848
Time zone for time which Timestamp will be converted to.
833
849
None will remove timezone holding UTC time.
834
850
0 commit comments