我试图将函数传递给数据集以对数据框中的非数值数据进行归一化,但是我不断收到此错误:
TypeError:TypeError:tf__norm()接受1个位置参数,但给出了2个
def norm(dataframe1):
for header in dataframe1._get_numeric_data().columns:
dataframe1[header] = (dataframe1[header] - dataframe1[header].mean())/dataframe1[header].std()
return dataframe1
enter code here
train, val= train_test_split( dataframe1, test_size =0.2)
def df_to_dataset(dataframe, shuffle=True, batch_size=32):
dataframe = dataframe.copy()
labels = dataframe.pop("target")
ds = tf.data.Dataset.from_tensor_slices((dict(dataframe), labels))
if shuffle:
ds = ds.shuffle(buffer_size=len(dataframe))
ds = ds.batch(batch_size)
ds=ds.map(norm)
return ds