One - One Code All

Blog Content

python时间序列pandas计算涨跌幅

Python 智能投研 统计学-科学计算   2013-06-08 22:36:57

涨跌幅定义为今日收盘价减去昨日收盘价。(close_today - close_yesterday) / close_yesterday


利用 diff 函数快速计算涨跌幅。
# data
#rise = dataframe1.closing_price.diff()
rise = dataframe1['closing_price'].diff()
data['rise'] = rise
data.head()


上一篇:sklearn加载自主数据
下一篇:"Mysql has gone away"的几种可能

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