Fix bug when nan_policy='raise'

This commit is contained in:
RunasSudo 2022-10-20 20:59:06 +11:00
parent b31ae6686f
commit bae93b2c8e
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
1 changed files with 1 additions and 0 deletions

View File

@ -31,6 +31,7 @@ def check_nan(df, nan_policy):
if nan_policy == 'raise':
if pd.isna(df).any(axis=None):
raise ValueError('NaN in input, pass nan_policy="warn" or "omit" to ignore')
return df
elif nan_policy == 'warn':
df_cleaned = df.dropna()
if len(df_cleaned) < len(df):