One - One Code All

Blog Content

pandas把dataframe转成Series,改变列中值的类型

Python 统计学-科学计算   2016-04-17 18:28:15

pandas把dataframe转成Series,改变列中值的类型


使用 pd.Series把dataframe转成Series


ts = pd.Series(df['Value'].values, index=df['Date'])


使用astype改变列中的值的类型,注意前面要有np


df['列名'] = df['列名'].astype(np.int64)




上一篇:flask应用sqlalchemy数据库连不上lost connection,session inactive, no bound
下一篇:flask解决SQLAlchemy提示not bound to Session错误的问题session.merge

The minute you think of giving up, think of the reason why you held on so long.