I was going through a lot of questions here but nothing is working for me. I try to get an Datetime index for my Pandas Dataframe. tried resample, asfreq. The index is already a Datetime Object, but it keeps the NONE freq.
dfz = sale.loc[(sale.Open == 1) & (sale.Promo == 0) & (sale.Sales > 0), ["Sales", "Customers"]]
print(dfz.asfreq('M').index)
print(dfz.index)
Result is:
DatetimeIndex([], dtype='datetime64[ns]', name='Date', freq='M')
DatetimeIndex(['2015-07-20', '2015-07-20', '2015-07-20', '2015-07-20',
'2015-07-20', '2015-07-20', '2015-07-20', '2015-07-20',
'2015-07-20', '2015-07-20',
...
'2013-01-06', '2013-01-06', '2013-01-06', '2013-01-06',
'2013-01-06', '2013-01-06', '2013-01-06', '2013-01-06',
'2013-01-06', '2013-01-06'],
dtype='datetime64[ns]', name='Date', length=467463, freq=None)
Sales Customers
Why does it show me a freq in the result of the asfreq but when I call the index it is still NONE?