怎样改变pandas dataframe数据类型 | How to change the data type of pandas dataframe

怎样改变pandas dataframe数据类型?

把全部column (fileds) 改成float

df = df.astype(float)

怎样把pandas dataframe的一个column变成numpy array?

type(df['col1'])

# pandas.core.series.Series
type(df['col1'].to_numpy())

# numpy.ndarray

Leave a Comment

Your email address will not be published.