Reputation: 536
I create a DataFrame and set its frequency to '15T':
import pandas as pd
d = {'T': [1, 2, 3, 4], 'H': [3, 4, 5, 6]}
df = pd.DataFrame(data=d, index=['10.09.2018 13:15:00','10.09.2018 13:30:00',
'10.09.2018 13:45:00', '10.09.2018 14:00:00'])
df.index = pd.to_datetime(df.index)
df.index.freq = '15T'
I call the function df.index to see if everything worked fine.
df.index
Out[19]:
DatetimeIndex(['2018-10-09 13:15:00', '2018-10-09 13:30:00',
'2018-10-09 13:45:00', '2018-10-09 14:00:00'],
dtype='datetime64[ns]', freq='15T')
My question: How can I call the freq in that index and save it to a variable? I tried the following but it didn't work.
a = df.index.freq
Could you give me some additional information in general on how to call elements of my Output in general ? E.g. if I wanted to save the dtype and not the frequency.
Upvotes: 1
Views: 235