Skip to content

Commit

Permalink
MAINT Fix pandas nightly (#728)
Browse files Browse the repository at this point in the history
* replace set np.NaN by pd.NA

* Update skrub/_fuzzy_join.py

---------

Co-authored-by: Gael Varoquaux <[email protected]>
  • Loading branch information
Vincent-Maladiere and GaelVaroquaux authored Sep 1, 2023
1 parent 1cd57e3 commit dcf6061
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions skrub/_fuzzy_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,11 @@ def fuzzy_join(
if drop_unmatched:
df_joined.drop(columns=["fj_idx"], inplace=True)
else:
idx = df_joined.index[df_joined["fj_nan"] == 1]
if len(idx) != 0:
df_joined.iloc[idx, df_joined.columns.get_loc("fj_idx") :] = np.NaN
mask_na = df_joined["fj_nan"] == 1
if mask_na.any():
right_cols = df_joined.columns[df_joined.columns.get_loc("fj_idx") :]
df_joined[right_cols] = pd.DataFrame.convert_dtypes(df_joined[right_cols])
df_joined.loc[mask_na, right_cols] = pd.NA
df_joined.drop(columns=["fj_idx", "fj_nan"], inplace=True)

if return_score:
Expand Down

0 comments on commit dcf6061

Please sign in to comment.