[英]I have a dataframe table with a ticker column and a date column. I want to calculate the price of the ticker at the corresponding date
[英]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?
我正在嘗試計算每個股票的平均調整收盤價,但我不確定如何索引調整價格
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()
應該給你一個新的 dataframe ,其中只有你想要的每個股票的列,然后
如果這不是您需要的解決方案或者您想閱讀它,請嘗試搜索“分層索引”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.