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

fix comparison with NaNs #285

Merged
merged 1 commit into from
Aug 16, 2023
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
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
Loading