COVID19
COVID19 copied to clipboard
Kalman filter prediction
I'm having trouble with r code snippet of kalman filter:
p=%R pred_all
gives an error like below. Can you please help me to solve this error?
AttributeError: type object 'DataFrame' has no attribute 'from_items'
Detailed error message:
AttributeError Traceback (most recent call last)
~\anaconda\lib\site-packages\IPython\core\interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth) 2315 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals 2316 with self.builtin_trap: -> 2317 result = fn(*args, **kwargs) 2318 return result 2319
~\anaconda\lib\site-packages\IPython\core\magic.py in
~\anaconda\lib\site-packages\rpy2\ipython\rmagic.py in R(self, line, cell, local_ns) 755 if result is not ri.NULL: 756 with localconverter(converter) as cv: --> 757 res = cv.ri2py(result) 758 return res 759
~\anaconda\lib\functools.py in wrapper(*args, **kw) 838 '1 positional argument') 839 --> 840 return dispatch(args[0].class)(*args, **kw) 841 842 funcname = getattr(func, 'name', 'singledispatch function')
~\anaconda\lib\site-packages\rpy2\robjects\pandas2ri.py in ri2py_dataframe(obj) 189 def ri2py_dataframe(obj): 190 items = tuple((k, ri2py(v)) for k, v in obj.items()) --> 191 res = PandasDataFrame.from_items(items) 192 return res 193
AttributeError: type object 'DataFrame' has no attribute 'from_items'
Can you verify 'rpy2' is well installed and you are allowed to pass df objects from R to Python? Try a simple example.