I have a pandas.Series object s
.
s.iloc[5:9]
returns the following content:
>>> s.iloc[5:9]
date
2019-01-09 49.6
2019-01-10 79.3
2019-01-11 89.4
2019-01-14 61.7
Name: price, dtype: float64
Is it possible to get the index '2019-01-09'
using s
and its corresponding position 5
?
I mean I want a function like this:
>>> get_index_by_position(s, 5)
'2019-01-09'
>>> get_index_by_position(s, 6)
'2019-01-10'
>>> get_index_by_position(s, 8)
'2019-01-14'
How can I implement get_index_by_position()
?