0

I have been trying to use the pyRserve for time series forecast and intent to use the auto.arima function in R.

I used the following code to solve the problem of functions with a dot in their names such as auto.arima:

import pyRserve
import pandas as pd
import numpy
conn = pyRserve.connect()

df = pd.read_excel('D:/My Path/C9.xlsx', sheet_name='C9')
aList = df['Value'].tolist()  # Cast the desired column into a python list
aList = numpy.array(aList)
conn.r.List = aList

auto_arima = getattr(conn.r, 'auto.arima')
conn.r.sapply(conn.ref.List, auto_arima)

but, it returned this error:

Traceback (most recent call last):
  File "D:/Forecast/Python/R2Python/R2P_Practice.py", line 21, in <module>
    auto_arima = getattr(conn.r, 'auto.arima')
  File "C:\Python27\lib\site-packages\pyRserve\rconn.py", line 308, in __getattr__
    'defined in Rserve' % realname)
NameError: no such variable or function "auto.arima" defined in Rserve

It seems the auto.arima is not defined in Rserve. Why isn't it there? How can I fix this?

Mike
  • 1
  • 1
  • 1
    "Does anyone have any experience on that?" Is not a question that should be answered. Ask instead "Why isn't `auro.arima` defined in Rserve?" or "What might I have done wrong to be receiving this error?". Also, including your imports will likely be helpful to those who could answer this question. – Joey Harwood Dec 21 '17 at 17:48
  • @JoeyHarwood Thanks! The question is edited. – Mike Dec 22 '17 at 19:03

0 Answers0