错误显示“NotImplementedError:dd.DataFrame.apply仅支持axis = 1尝试:df.apply(func,axis = 1)”
这是我的代码行:
# Read the CSV file in using dask
import dask.dataframe as dd
df = dd.read_csv('CICIDSs.csv')
features = df.dtypes[df.dtypes !='object'].index
df[features] = df[features].apply(
lambda x: (x-x.mean())/ (x.std()))
#fill empty values by 0
df_pre = df.fillna(0)
print('===== Data Preprocessing =====')
print(df_pre)
我尝试使用建议的代码,但它输出一个错误,其中显示
func is not defined
而不是
df[features] = df[features].apply(
lambda x: (x-x.mean())/ (x.std()))
你尝试过吗:
df[features] = df[features].apply(
lambda x: (x-x.mean())/ (x.std()),
axis=1)