@@ -372,7 +372,7 @@ cdef class _Timestamp(datetime):
372
372
class Timestamp (_Timestamp ):
373
373
""" Pandas replacement for datetime.datetime
374
374
375
- TimeStamp is the pandas equivalent of python's Datetime
375
+ Timestamp is the pandas equivalent of python's Datetime
376
376
and is interchangable with it in most cases. It's the type used
377
377
for the entries that make up a DatetimeIndex, and other timeseries
378
378
oriented data structures in pandas.
@@ -383,10 +383,12 @@ class Timestamp(_Timestamp):
383
383
Value to be converted to Timestamp
384
384
freq : str, DateOffset
385
385
Offset which Timestamp will have
386
- tz : string , pytz.timezone, dateutil.tz.tzfile or None
386
+ tz : str , pytz.timezone, dateutil.tz.tzfile or None
387
387
Time zone for time which Timestamp will have.
388
- unit : string
389
- numpy unit used for conversion, if ts_input is int or float
388
+ unit : str
389
+ Unit used for conversion if ts_input is of type int or float. The
390
+ valid values are 'D', 'h', 'm', 's', 'ms', 'us', and 'ns'. For
391
+ example, 's' means seconds and 'ms' means milliseconds.
390
392
offset : str, DateOffset
391
393
Deprecated, use freq
392
394
@@ -408,9 +410,23 @@ class Timestamp(_Timestamp):
408
410
409
411
Examples
410
412
--------
413
+ Using the primary calling convention:
414
+
415
+ This converts a datetime-like string
411
416
>>> pd.Timestamp('2017-01-01T12')
412
417
Timestamp('2017-01-01 12:00:00')
413
418
419
+ This converts a float representing a Unix epoch in units of seconds
420
+ >>> pd.Timestamp(1513393355.5, unit='s')
421
+ Timestamp('2017-12-16 03:02:35.500000')
422
+
423
+ This converts an int representing a Unix-epoch in units of seconds
424
+ and for a particular timezone
425
+ >>> pd.Timestamp(1513393355, unit='s', tz='US/Pacific')
426
+ Timestamp('2017-12-15 19:02:35-0800', tz='US/Pacific')
427
+
428
+ Using the other two forms that mimic the API for ``datetime.datetime``:
429
+
414
430
>>> pd.Timestamp(2017, 1, 1, 12)
415
431
Timestamp('2017-01-01 12:00:00')
416
432
@@ -432,7 +448,7 @@ class Timestamp(_Timestamp):
432
448
date corresponding to a proleptic Gregorian ordinal
433
449
freq : str, DateOffset
434
450
Offset which Timestamp will have
435
- tz : string , pytz.timezone, dateutil.tz.tzfile or None
451
+ tz : str , pytz.timezone, dateutil.tz.tzfile or None
436
452
Time zone for time which Timestamp will have.
437
453
offset : str, DateOffset
438
454
Deprecated, use freq
@@ -450,7 +466,7 @@ class Timestamp(_Timestamp):
450
466
451
467
Parameters
452
468
----------
453
- tz : string / timezone object, default None
469
+ tz : str or timezone object, default None
454
470
Timezone to localize to
455
471
"""
456
472
if is_string_object(tz):
@@ -468,7 +484,7 @@ class Timestamp(_Timestamp):
468
484
469
485
Parameters
470
486
----------
471
- tz : string / timezone object, default None
487
+ tz : str or timezone object, default None
472
488
Timezone to localize to
473
489
"""
474
490
return cls .now(tz)
@@ -777,7 +793,7 @@ class Timestamp(_Timestamp):
777
793
778
794
Parameters
779
795
----------
780
- tz : string , pytz.timezone, dateutil.tz.tzfile or None
796
+ tz : str , pytz.timezone, dateutil.tz.tzfile or None
781
797
Time zone for time which Timestamp will be converted to.
782
798
None will remove timezone holding local time.
783
799
@@ -831,7 +847,7 @@ class Timestamp(_Timestamp):
831
847
832
848
Parameters
833
849
----------
834
- tz : string , pytz.timezone, dateutil.tz.tzfile or None
850
+ tz : str , pytz.timezone, dateutil.tz.tzfile or None
835
851
Time zone for time which Timestamp will be converted to.
836
852
None will remove timezone holding UTC time.
837
853
0 commit comments