Pandas Dataframe with timestamp series fails to convert

Create issue
Issue #15 new
Mark created an issue

Now that I have the awesome PythonInR running in Windows 10, I am able to transfer dataframes from pandas in python to R unless that dataframe contains a timestamp series. When I try to pull in a dataframe with a column of this type, I get the following error:

annot coerce class ""PythonObject"" to a data.frame[1] "cannot coerce class \"\"PythonObject\"\" to a data.frame"
[1] "errorMessage"

If I drop that column from my pandas dataframe and then attempt


the dataframe returns to R as expected, so I know the problem with that column. Any ideas?

Comments (5)

  1. Florian Schwendinger repo owner

    timestamp series are currently not supported by PythonInR the easiest solution is to type cast this column to string and import afterwards.

    pyExec("index = pd.date_range('2000-1-1', periods=10, freq='M')")
    pyGet("[str(i) for i in index]")

    But thank you for the hint I will put it in the next PythonInR version.

  2. Mark reporter

    Awesome, Florian. That did the trick! Thank you so much for the tip. I really appreciate it! Any idea when you have the next release slated for?

    Thanks again for putting out such a really great package!

  3. Mark reporter

    One last thing too: is it possible to pass parameters to external python code? If not, that would be really great for a future release. Something like:

    pyExecfile(filename, key1=value1, key2=value2, . . . , keyn=valuen)

    where the key value pairs are passed into the .py file to pass into the python program. This would really come in handy for the secret API keys that I show in my code in issue #14.


  4. Mark reporter

    Thinking more about this I guess I could just set up my .py script as a function and make a call to is with pyFunction.


  5. Log in to comment