Commit d857dc4b authored by René Paris's avatar René Paris Committed by Reinhard Biegel
Browse files

hotfix(pyOpenPASS): Fill NaN values

Due to changes in the core, some values might become NaN when agents
leave the world (e.g. Lane). This edgecases are now filled with previous

**NOTE**: This is only a hotfix as it unconditionally fills NaN values.
In some columns NaN values are allowed (e.g. DetectedObjects) and
querying this such columns could lead to erroneous results. With this
fix, only the first transition from "NaN to value" is still correct.

Before  | After
NaN     | NaN
value1  | value1
value2  | value2
NaN     | value2 (filled)
parent 0004be69
Pipeline #2928 failed with stage
in 0 seconds
......@@ -93,7 +93,6 @@ def add_shifted_column(data, shifted_column):
# copy datatype, as shift might have made int to float (needs NaN for empty values)
data[new_column] = data[new_column].astype(data[column].dtypes)
return data
......@@ -158,4 +157,8 @@ def prepare_output(csv_file, agents, datatypes):
# merge agent info
data = pd.merge(data, agents, on=['AgentId'], how='outer')
# some values might become NaN when agents leave world - this edgecases are filled with "old values"
for column in data.columns:
data[column] = data.groupby('AgentId')[column].fillna(method='ffill')
return data
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment