heartandsole.Activity.records_unique

property Activity.records_unique

Unique rows in the records DataFrame.

Sometimes, a data source will repeat a record at the end of one lap and the beginning of the next one. This property drops lap numbering from the records DataFrame and returns the unique records.

Examples

>>> 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'],
...   'lat': [40.037947, 40.037947, 40.037947, 40.037919],
...   'lon': [-105.259236, -105.259276, -105.259276, -105.259354],
...   'distance': [0.0, 3.4, 3.4, 11.1],
...   'elevation': [1626.6, 1626.6, 1626.6, 1626.6],
...   'lap': [0, 0, 1, 1]
... })
>>> act = Activity(records)
>>> act.records
            timestamp        lat         lon  distance  elevation  lap  time
0 2021-04-16 13:38:54  40.037947 -105.259236       0.0     1626.6    0     0
1 2021-04-16 13:38:56  40.037947 -105.259276       3.4     1626.6    0     2
2 2021-04-16 13:38:56  40.037947 -105.259276       3.4     1626.6    1     2
3 2021-04-16 13:39:01  40.037919 -105.259354      11.1     1626.6    1     7
>>> act.records_unique
            timestamp        lat         lon  distance  elevation  time
0 2021-04-16 13:38:54  40.037947 -105.259236       0.0     1626.6     0
1 2021-04-16 13:38:56  40.037947 -105.259276       3.4     1626.6     2
2 2021-04-16 13:39:01  40.037919 -105.259354      11.1     1626.6     7