Skip to content

Commit

Permalink
Bug when empty row doesn't have correct number of NAs (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeEfstathiadis authored Feb 16, 2024
1 parent 1c0e7bc commit 02c4a6c
Showing 1 changed file with 12 additions and 1 deletion.
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

0 comments on commit 02c4a6c

Please sign in to comment.