Calculating returns from a dataframe with financial data

后端 未结 4 1097
不知归路
不知归路 2021-02-02 11:44

I have a dataframe with monthly financial data:

In [89]: vfiax_monthly.head()
Out[89]: 
            year  month  day       d   open  close   high    low  volume          


        
4条回答
  •  花落未央
    2021-02-02 12:44

    Could also use a mix of diff and shift methods of pandas series:

    retrun = vfiax_monthly.open.diff()/vfiax_monthly.open.shift(1)
    

提交回复
热议问题