pandas.Series.dt.components#
- Series.dt.components[source]#
Return a Dataframe of the components of the Timedeltas.
Each row of the DataFrame corresponds to a Timedelta in the original Series and contains the individual components (days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds) of the Timedelta.
- Returns:
- DataFrame
See also
TimedeltaIndex.components
Return a DataFrame of the individual resolution components of the Timedeltas.
Series.dt.total_seconds
Return the total number of seconds in the duration.
Examples
>>> s = pd.Series(pd.to_timedelta(np.arange(5), unit="s")) >>> s 0 0 days 00:00:00 1 0 days 00:00:01 2 0 days 00:00:02 3 0 days 00:00:03 4 0 days 00:00:04 dtype: timedelta64[ns] >>> s.dt.components days hours minutes seconds milliseconds microseconds nanoseconds 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 2 0 0 0 2 0 0 0 3 0 0 0 3 0 0 0 4 0 0 0 4 0 0 0