heartandsole.Activity.time.records_from_timestamps¶
- Activity.time.records_from_timestamps(inplace=False)[source]¶
Time records calculated from timestamp records.
- Parameters
inplace (bool) – Whether to add the Series result as a column to the records DataFrame. Default False.
- Returns
The Series result or None if
inplace=Trueor if the records DataFrame does contain atimestampcolumn.- Return type
pandas.Series or None
Examples
This method is automatically called with
inplace=Trueupon creation of an Activity, provided the input records DataFrame has a timestamp column but no time column:>>> records = pd.DataFrame({ ... 'timestamp': ['2021-04-16 13:38:54', ... '2021-04-16 13:38:56', ... '2021-04-16 13:38:56', ... '2021-04-16 13:39:01'], ... }) >>> act = Activity(records) >>> act.records timestamp time 0 2021-04-16 13:38:54 0 1 2021-04-16 13:38:56 2 2 2021-04-16 13:38:56 2 3 2021-04-16 13:39:01 7
When called with
inplace=False, this method returns a Series:>>> act.time.records_from_timestamps() 0 0 1 2 2 2 3 7 Name: time, dtype: int64