Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when empty row doesn't have correct number of NAs #242

Merged
merged 3 commits into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion forest/jasmine/traj2stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,9 @@ def gps_summaries(
# if there is no data in the day, then we need to
# to add empty rows to the dataframe with 21 columns
res = [year, month, day] + [0] * 18

if parameters.pcr_bool:
res += [pd.NA] * 2
if places_of_interest is not None:
# add empty data for places of interest
# for daytime/nighttime + other
Expand All @@ -1205,7 +1208,15 @@ def gps_summaries(
elif sum(index_rows) == 0 and not parameters.split_day_night:
# There is no data and it is daily data, so we need to add empty
# rows
res = [year, month, day] + [0] * 3 + [pd.NA] * 15
if frequency == Frequency.DAILY:
res = [year, month, day] + [0] * 3 + [pd.NA] * 15

if parameters.pcr_bool:
res += [pd.NA] * 2
else:
# if there is no data in the day, then we need to
# add empty rows to the dataframe with 21 columns
res = [year, month, day, hour] + [0] + [pd.NA] * 11

if places_of_interest is not None:
# add empty data for places of interest
Expand Down
Loading