File tree 1 file changed +20
-4
lines changed
1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -237,14 +237,30 @@ def to_pytimedelta(self):
237
237
@property
238
238
def components (self ):
239
239
"""
240
- Return a dataframe of the components (days, hours, minutes,
241
- seconds, milliseconds, microseconds, nanoseconds) of the Timedeltas.
240
+ Return a Dataframe of the components of the Timedeltas.
242
241
243
242
Returns
244
243
-------
245
- a DataFrame
244
+ DataFrame
246
245
247
- """
246
+ Examples
247
+ --------
248
+ >>> s = pd.Series(pd.to_timedelta(np.arange(5), unit='s'))
249
+ >>> s
250
+ 0 00:00:00
251
+ 1 00:00:01
252
+ 2 00:00:02
253
+ 3 00:00:03
254
+ 4 00:00:04
255
+ dtype: timedelta64[ns]
256
+ >>> s.dt.components
257
+ days hours minutes seconds milliseconds microseconds nanoseconds
258
+ 0 0 0 0 0 0 0 0
259
+ 1 0 0 0 1 0 0 0
260
+ 2 0 0 0 2 0 0 0
261
+ 3 0 0 0 3 0 0 0
262
+ 4 0 0 0 4 0 0 0
263
+ """ # noqa: E501
248
264
return self ._get_values ().components .set_index (self .index )
249
265
250
266
@property
You can’t perform that action at this time.
0 commit comments