怎樣改變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.