Python Arima X13 model gets AttributeError: 'NoneType' object has no attribute 'startswith'

I am trying to run the following code and at the end of the code, I get this error:

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import seaborn as sns
import statsmodels as sm
from statsmodels.tsa.x13 import x13_arima_select_order, _find_x12
import os

df_railroad=pd.read_csv('Input_Data1.csv')

XPATH = os.chdir('C:/Users/walkea24/Downloads/winx13_V2.5/WinX13/x13as')

df_railroad.rename(columns={'US Railroad Traffic Originated: Intermodal + 
Carloads (Units)':'Railroad'}, inplace=True)

df_railroad.set_index('Date', inplace=True)
temp_series = 
pd.DataFrame(df_railroad["Railroad"].values,index=df_railroad.index)
x13results = sm.tsa.x13.x13_arima_analysis(endog = 
temp_series,x12path=XPATH, freq='M',outlier=True,print_stdout=True)


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
C:\PythonPlus\64bit\envs\Python36\lib\site-packages\statsmodels\tsa\x13.py 
in pandas_to_series_spec(x)
    291     try:
--> 292         period = _freq_to_period[x.index.freqstr]
    293     except (AttributeError, ValueError):

AttributeError: 'Index' object has no attribute 'freqstr'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
<ipython-input-7-0721f586e7a5> in <module>()
      1 temp_series = 
pd.DataFrame(df_railroad["Railroad"].values,index=df_railroad.index)
----> 2 x13results = sm.tsa.x13.x13_arima_analysis(endog = 
temp_series,x12path=XPATH, freq='M',outlier=True,print_stdout=True)

C:\PythonPlus\64bit\envs\Python36\lib\site-packages\statsmodels\tsa\x13.py 
in x13_arima_analysis(endog, maxorder, maxdiff, diff, exog, log, outlier, 
trading, forecast_years, retspec, speconly, start, freq, print_stdout, 
x12path, prefer_x13)
    412                                                         
periods=len(endog),
    413                                                         freq=freq))
--> 414     spec_obj = pandas_to_series_spec(endog)
    415     spec = spec_obj.create_spec()
    416     spec += "transform{{function={0}}}\n".format(_log_to_x12[log])

C:\PythonPlus\64bit\envs\Python36\lib\site-packages\statsmodels\tsa\x13.py 
in pandas_to_series_spec(x)
    293     except (AttributeError, ValueError):
    294         from pandas.tseries.api import infer_freq
--> 295         period = _freq_to_period[infer_freq(x.index)]
    296     start_date = x.index[0]
    297     if period == 12:

C:\PythonPlus\64bit\envs\Python36\lib\site-packages\statsmodels\tsa\x13.py 
in __getitem__(self, key)
     29 class _freq_to_period:
     30     def __getitem__(self, key):
---> 31         if key.startswith('M'):
     32             return 12
     33         elif key.startswith('Q'):

AttributeError: 'NoneType' object has no attribute 'startswith'

I am not sure why it is saying NoneType has no attribute 'startswith' because I have the proper data setup with my left column as a date index and the right as values. Statsmodels should be able to infer that I have a date variable on the right. Below is the beginning of my data:

Date US Railroad Traffic Originated: Intermodal + Carloads (Units) 1/31/1990 1593540 2/28/1990 1667441 3/31/1990 2124852 4/30/1990 1685441 5/31/1990 1710519 6/30/1990 2111856

728x90

0 Answers Python Arima X13 model gets AttributeError: 'NoneType' object has no attribute 'startswith'