Skip to content

Commit

Permalink
[fix] fix replace nan method
Browse files Browse the repository at this point in the history
  • Loading branch information
micchu committed Oct 9, 2024
1 parent 56e76b4 commit 9c91759
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bdpy/fig/makeplots2.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,10 @@ def __weird_form_to_long(df, target_col, identify_cols=[]):
identify_cols: list of str
A list of columns to keep in the decomposed dataframe, other than target_col.
"""
# replace NaN to [np.nan]
nans = df[target_col].isna()
df[target_col][nans] = [np.nan]
# # replace NaN to [np.nan]
nan_index = np.where(df[target_col].isna())[0]
for i in nan_index:
df.at[i, target_col] = [np.nan]
# Weird form
df_result = pd.DataFrame()
for i, row in df.iterrows():
Expand Down

0 comments on commit 9c91759

Please sign in to comment.