我想计算股票的每日回报
Closing_Date AAL_Close AAPL_Close
665 2015-01-12 49.580002 27.312500
666 2015-01-13 50.400002 27.555000
667 2015-01-14 49.410000 27.450001
668 2015-01-15 49.410000 26.705000
669 2015-01-16 49.810001 26.497499
我想将今天的股票价格除以昨天的股价。第一行将导致NAN或空。它正在计算每日回报。
我想将今天的股票价格除以昨天的股价。第一行将导致NAN或空。它正在计算每日回报。
Closing_Date AAL_Close AAPL_Close
665 2015-01-12 49.580002 27.312500
666 2015-01-13 50.400002 27.555000
667 2015-01-14 49.410000 27.450001
668 2015-01-15 49.410000 26.705000
669 2015-01-16 49.810001 26.497499
I want to divide stock price of today by stock price of yesterday . The first row will result in Nan or empty . It is calculating for daily returns .
I want to divide stock price of today by stock price of yesterday . The first row will result in Nan or empty . It is calculating for daily returns .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您有所有连续的日期:
或者如果您真的想依靠上一个日期:
输出:
Assuming that you have all consecutive dates:
Or if you really want to rely on the previous date:
output: