Pandas replacement for python datetime.datetime object.
Timestamp is the pandas equivalent of pythonâs Datetime and is interchangeable with it in most cases. Itâs the type used for the entries that make up a DatetimeIndex, and other timeseries oriented data structures in pandas.
Value to be converted to Timestamp.
Value of year.
Value of month.
Value of day.
Value of hour.
Value of minute.
Value of second.
Value of microsecond.
Timezone info.
Value of nanosecond.
Time zone for time which Timestamp will have.
Unit used for conversion if ts_input is of type int or float. The 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 the unit attribute will be set as 'ns'
.
Due to daylight saving time, one wall clock time can occur twice when shifting from summer to winter time; fold describes whether the datetime-like corresponds to the first (0) or the second time (1) the wall clock hits the ambiguous time.
See also
Timedelta
Represents a duration, the difference between two dates or times.
datetime.datetime
Python datetime.datetime object.
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.
Examples
Using the primary calling convention:
This converts a datetime-like string
>>> pd.Timestamp('2017-01-01T12') Timestamp('2017-01-01 12:00:00')
This converts a float representing a Unix epoch in units of seconds
>>> 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
>>> 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 mimic the API for datetime.datetime
:
>>> pd.Timestamp(2017, 1, 1, 12) Timestamp('2017-01-01 12:00:00')
>>> pd.Timestamp(year=2017, month=1, day=1, hour=12) Timestamp('2017-01-01 12:00:00')
Attributes
Methods
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4