pandas.Timestamp¶
-
class
pandas.Timestamp¶ TimeStamp is the pandas equivalent of python’s Datetime and is interchangable 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.
There are essentially three calling conventions for the constructor. The primary form accepts four parameters. They can be passed by position or keyword.
Parameters: ts_input : datetime-like, str, int, float
Value to be converted to Timestamp
freq : str, DateOffset
Offset which Timestamp will have
tz : string, pytz.timezone, dateutil.tz.tzfile or None
Time zone for time which Timestamp will have.
unit : string
numpy unit used for conversion, if ts_input is int or float
offset : str, DateOffset
Deprecated, use freq
The other two forms mimic the parameters from ``datetime.datetime``. They
can be passed by either position or keyword, but not both mixed together.
Attributes
Methods
astimezoneConvert tz-aware Timestamp to another time zone. ceilreturn a new Timestamp ceiled to this resolution combinectimeReturn ctime() style string. dateReturn date object with same year, month and day. dstReturn self.tzinfo.dst(self). floorreturn a new Timestamp floored to this resolution fromordinalpassed an ordinal, translate and convert to a ts fromtimestampisocalendarReturn a 3-tuple containing ISO year, week number, and weekday. isoformatisoweekdayReturn the day of the week represented by the date. normalizeNormalize Timestamp to midnight, preserving tz information. nowReturn the current time in the local timezone. replaceimplements datetime.replace, handles nanoseconds roundRound the Timestamp to the specified resolution strftimeformat -> strftime() style string. strptimestring, format -> new datetime parsed from a string (like time.strptime()). timeReturn time object with same time but with tzinfo=None. timestampReturn POSIX timestamp as float. timetupleReturn time tuple, compatible with time.localtime(). timetzReturn time object with same time and tzinfo. to_datetimeDEPRECATED: use to_pydatetime()instead.to_datetime64Returns a numpy.datetime64 object with ‘ns’ precision to_julian_dateConvert TimeStamp to a Julian Date. to_periodReturn an period of which this timestamp is an observation. to_pydatetimeConvert a Timestamp object to a native Python datetime object. todayReturn the current time in the local timezone. toordinalReturn proleptic Gregorian ordinal. tz_convertConvert tz-aware Timestamp to another time zone. tz_localizeConvert naive Timestamp to local time zone, or remove timezone from tz-aware Timestamp. tznameReturn self.tzinfo.tzname(self). utcfromtimestamputcnowutcoffsetReturn self.tzinfo.utcoffset(self). utctimetupleReturn UTC time tuple, compatible with time.localtime(). weekdayReturn the day of the week represented by the date.