Skip to content

Commit

Permalink
fix comparison with NaNs (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
shouples authored Aug 16, 2023
1 parent d40113d commit 6eaf6d4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/dx/utils/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ def get_df_variable_name(
# ...and for any non-pandas DataFrame objects, we need to convert them so
# equality checks pass and we properly detect the matching variable
other_df = to_dataframe(v)
if df.equals(other_df):
# ......also, in the event we have NaNs/NAs, we can't correctly compare values from one
# dataframe to another, so we need to compare the string representations of the values to
# avoid making things more complicated than they already are
if df.astype(str).equals(other_df.astype(str)):
logger.debug(f"`{k}` matches this dataframe")
matching_df_vars.append(k)
logger.debug(f"dataframe variables with same data: {matching_df_vars}")
Expand Down

0 comments on commit 6eaf6d4

Please sign in to comment.