从熊猫数据系列中获取最小值的日期
Get the date of a minimum value from panda data series
是否有任何(优雅的)方法来获得找到的最小值的日期,而不仅仅是股票价值?
import datetime
from pandas_datareader import data
ticker = 'V'
start = datetime.datetime(2010, 5, 15)
end = datetime.datetime(2010, 6, 15)
stock_values = data.DataReader(ticker,
start=start,
end=end,
data_source='yahoo')
min_close_value = stock_values['Close'].min() # 17.522499084472656
# min_close_date =
使用argmin,其中returns索引的最小值:
index_of_min_close_value = stock_values['Close'].argmin()
是否有任何(优雅的)方法来获得找到的最小值的日期,而不仅仅是股票价值?
import datetime
from pandas_datareader import data
ticker = 'V'
start = datetime.datetime(2010, 5, 15)
end = datetime.datetime(2010, 6, 15)
stock_values = data.DataReader(ticker,
start=start,
end=end,
data_source='yahoo')
min_close_value = stock_values['Close'].min() # 17.522499084472656
# min_close_date =
使用argmin,其中returns索引的最小值:
index_of_min_close_value = stock_values['Close'].argmin()