我试图找出wipro close price
是max
每year
的日期。(什么日期,什么价格?)以下是我尝试过的一些代码的示例:
import pandas as pd
import numpy as np
from nsepy import get_history
import datetime as dt
start = dt.datetime(2015, 1, 1)
end = dt.datetime.today()
wipro=get_history(symbol='WIPRO', start = start, end = end)
wipro.index = pd.to_datetime(wipro.index)
# This should get me my grouped results
wipro_agg = wipro.groupby(wipro.index.year).Close.idxmax()
您可以简单地调用“max”,就像调用“idxmax”一样
解决这个问题需要两个步骤。首先,获得每年的最高价格。然后,找到该实例的确切日期。你知道吗
相关问题 更多 >
编程相关推荐