pandas dataframe指定列字符串转成数字的方法 df['原价']=pd.factorize(df["原价"])[0].astype(float) df['原价']=pd.factorize(df["原价"])[0].astype(int)