Explicitly set pandas dtype to reduce memory usage and fix warning (#11145)

* Explicitly set dtype to reduce memory usage and fix warning

* remove extra line
This commit is contained in:
Nicolas Mowen 2024-04-29 05:23:08 -06:00 committed by GitHub
parent 90468c8bf5
commit 5858eee1fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -440,6 +440,7 @@ def motion_activity():
# resample data using pandas to get activity on scaled basis
df = pd.DataFrame(data, columns=["start_time", "motion", "camera"])
df = df.astype(dtype={"motion": "float16"})
# set date as datetime index
df["start_time"] = pd.to_datetime(df["start_time"], unit="s")
@ -517,6 +518,7 @@ def audio_activity():
# resample data using pandas to get activity on scaled basis
df = pd.DataFrame(data, columns=["start_time", "audio"])
df = df.astype(dtype={"audio": "float16"})
# set date as datetime index
df["start_time"] = pd.to_datetime(df["start_time"], unit="s")