pandas.TimedeltaIndex.components#

property TimedeltaIndex.components[源代码]#

返回一个包含 Timedeltas 各个解析组件的 DataFrame。

组件(天、小时、分钟、秒、毫秒、微秒、纳秒)作为列返回在一个DataFrame中。

返回:
DataFrame

例子

>>> tdelta_idx = pd.to_timedelta(["1 day 3 min 2 us 42 ns"])
>>> tdelta_idx
TimedeltaIndex(['1 days 00:03:00.000002042'],
               dtype='timedelta64[ns]', freq=None)
>>> tdelta_idx.components
   days  hours  minutes  seconds  milliseconds  microseconds  nanoseconds
0     1      0        3        0             0             2           42