4

I am hitting an error when reading a feather object into R that was put out from a python session.

In python:

In [248]: import pandas as pd

In [249]: pd.DataFrame({'col': ['a','b','c']}).to_feather('strings_df.feather')

In R:

> library(feather)
> df = read_feather('strings_df.feather')
Error in coldataFeather(x, i) : 
  RAW() can only be applied to a 'raw', not a 'list'

Is this related to the fact that strings are stored as objects in pandas.Series? Any thoughts on what's happening here?

Session info:

R

R version 3.3.1 (2016-06-21) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.10.5 (Yosemite)

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils
datasets methods base

other attached packages: [1] feather_0.3.0

loaded via a namespace (and not attached): [1] assertthat_0.1 hms_0.2 tools_3.3.1 tibble_1.2 Rcpp_0.12.5

Python

'2.7.10 (default, Jul 3 2015, 12:05:53) \n[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)]'

Pandas version: '0.20.3'

Numpy version: '1.13.1'

andrew
  • 2,524
  • 2
  • 24
  • 36

1 Answers1

0

The issue is simply that values in a string column should be of type unicode, not str. The following works as expected:

pd.DataFrame({'col': [u'a',u'b',u'c']}).to_feather('strings_df.feather')
andrew
  • 2,524
  • 2
  • 24
  • 36