1

I am trying to run

from statsmodels.tsa.seasonal import seasonal_decompose 

series = Series.from_csv("sugar_price_2.csv", header=0, sep=";", parse_dates=[0])

results = seasonal_decompose(series, model='additive')

This is Giving an Errror

"AttributeError: 'Index' object has no attribute 'inferred_freq'"

Cant Figure Out what's the issue, please help,

Also , please Help me with the Date parsing if needed as The dates are in - "" dd-mm-yy " format

Arnab_AI
  • 11
  • 1
  • 4
  • Could you please post some sample data and expected output for the users to help you precisely. :) Thanks – anky Aug 28 '18 at 15:30
  • Why do you have `series = series = Series....`? As far as dates are concerned, looks like your dates can be interpreted via `%m-%d-%y` – rahlf23 Aug 28 '18 at 15:36
  • Your time series data do not have a clear frequency like either the data is collected hourly or minutely or daily or monthly or yearly or some fixed frequency. Please check if this the issue. – Space Impact Aug 28 '18 at 15:38
  • I have edited @rahlf23 , it was a typo. – Arnab_AI Aug 29 '18 at 19:08
  • @rahlf23 , How shall i convert my Date Index to %m-%d-%y? – Arnab_AI Aug 29 '18 at 19:14
  • @anky_91 - here is the file link- https://files.fm/u/d7cnthrf#sign_up Its a Time series forecasting mate, Completely Unsupervised learning – Arnab_AI Aug 29 '18 at 19:15
  • @SandeepKadapa - Its collected daily for a timespan of 1 year almost... Now please tell hwat should I do to use seasonal_deompose() – Arnab_AI Aug 29 '18 at 19:16
  • try [this](https://stackoverflow.com/questions/42425774/using-statsmodels-seasonal-decompose-without-datetimeindex-but-with-known-freq/42445953#42445953): `seasonal_decompose(series.values, freq=3)`. – Ghasem Naddaf Aug 29 '18 at 20:08
  • @GhasemNaddaf When I run this it showing ["F:\Anaconda2\lib\site-packages\statsmodels\tsa\filters\filtertools.py:28: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future return np.r_[[np.nan] * head, x, [np.nan] * tail]" ] – Arnab_AI Sep 02 '18 at 13:02

1 Answers1

0

For date parsing use below code

parse_dates['DATE'] = series['DATE'].dt.strftime('%Y%m')
adiga
  • 34,372
  • 9
  • 61
  • 83