如何修复此示例中的 "only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices"

How to fix "only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices" in this example

我有以下类型的数据。

InvoiceNo   InvoiceDate InvoiceType PriceType   SellManNo   CustomerNo  PaymentDate Total
91          1/15/2019   4           2           1           700         1/15/2019   1140.55
92          1/15/2019   4           2           1           13          1/15/2019   201
93          1/15/2019   4           2           1           675         1/15/2019   500
94          1/15/2019   4           2           1           456         1/15/2019   48
95          1/15/2019   4           2           1           709         1/15/2019   276
96          1/15/2019   4           2           1           98          2/14/2019   299
97          1/15/2019   1           2           1           1           1/15/2019   45.66
98          1/15/2019   4           2           1           478         1/15/2019   2.88

这是我试过的:

from sklearn.preprocessing import MinMaxScaler
scaling=MinMaxScaler()
df_total=df[['Total']]

df_total=scaling.fit_transform(df_total)

df_total

然后我得到了错误。

only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

您只需要:

df['Total'] /= max(df['Total'])