Skip to content

Commit 3b4b6f0

Browse files
committed
fix(examples): fixed deprecated kwargs in to_datetime
1 parent b8f256f commit 3b4b6f0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

examples/load_dataframe.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
"""
22
Load ActivityWatch data into a dataframe, and export as CSV.
33
"""
4-
54
from datetime import datetime, timedelta, timezone
65

6+
import iso8601
77
import pandas as pd
8-
98
from aw_client import ActivityWatchClient
10-
from aw_client.queries import canonicalEvents, DesktopQueryParams
119
from aw_client.classes import default_classes
10+
from aw_client.queries import DesktopQueryParams, canonicalEvents
1211

1312

1413
def build_query() -> str:
@@ -47,7 +46,7 @@ def main() -> None:
4746
e["$category"] = " > ".join(e["$category"])
4847

4948
df = pd.json_normalize(events)
50-
df["timestamp"] = pd.to_datetime(df["timestamp"], infer_datetime_format=True)
49+
df["timestamp"] = pd.to_datetime(df["timestamp"].apply(iso8601.parse_date))
5150
df.set_index("timestamp", inplace=True)
5251

5352
print(df)

0 commit comments

Comments
 (0)