NameError: name 'resample' is not defined
NameError: name 'resample' is not defined
我正在尝试使用 python 中的重采样方法,但出现以下错误:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-22-9ff5896e97a3> in <module>
----> 1 df_no_default_downsampled=resample(df_no_deafult,replace=False,n_samples=1000,random_state=42)
2 df_default_downsampled=resample(df_deafult,replace=False,n_samples=1000,random_state=42)
NameError: name 'resample' is not defined
看来你需要DataFrame.sample
:
df_no_default_sampled=df_no_deafult.sample(replace=False,n=1000,random_state=42)
我正在尝试使用 python 中的重采样方法,但出现以下错误:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-22-9ff5896e97a3> in <module>
----> 1 df_no_default_downsampled=resample(df_no_deafult,replace=False,n_samples=1000,random_state=42)
2 df_default_downsampled=resample(df_deafult,replace=False,n_samples=1000,random_state=42)
NameError: name 'resample' is not defined
看来你需要DataFrame.sample
:
df_no_default_sampled=df_no_deafult.sample(replace=False,n=1000,random_state=42)