[英]how can i index the adj close price to calculate the mean of one stock when i downloaded multiple tickers and grouped them by ticker?
I am trying to calculate the mean adj close of every ticker but I am not sure how to index the adj price我正在尝试计算每个股票的平均调整收盘价,但我不确定如何索引调整价格
ADDYY ... BAS.DE
Open High Low ... Close Adj Close Volume
Date ...
2018-12-31 104.599998 105.050003 104.190002 ... NaN NaN NaN
2019-01-02 105.419998 105.559998 104.449997 ... 60.720001 48.283272 2564044.0
2019-01-03 105.809998 105.889999 104.510002 ... 60.020000 47.726646 2213589.0
2019-01-04 107.550003 109.190002 107.550003 ... 63.189999 50.247360 4197991.0
2019-01-07 108.610001 109.180000 108.419998 ... 62.900002 50.016762 2437345.0
... ... ... ... ... ... ...
2019-12-25 NaN NaN NaN ... NaN NaN NaN
2019-12-26 162.059998 162.199997 160.850006 ... NaN NaN NaN
2019-12-27 162.800003 163.570007 162.360001 ... 67.900002 56.472588 1640149.0
2019-12-30 164.000000 164.000000 162.009995 ... 67.349998 56.015144 936462.0
2019-12-31 161.990005 163.210007 161.990005 ... NaN NaN NaN
adjClose = df.loc[:,"Adj Close"].copy()
should get you a new dataframe with just the column you want from each ticker, then应该给你一个新的 dataframe ,其中只有你想要的每个股票的列,然后
if this isn't the solution you need or you want to read up on it try searching "Hierarchical indexing"如果这不是您需要的解决方案或者您想阅读它,请尝试搜索“分层索引”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.