R cannot read Python Pandas dataframe saved in feather format

Viewed 3678

I have a pandas dataframe dfwin. enter image description here

And I save it to feather format hoping I can read it in R.

enter image description here

But R always throws the error "Error in openFeather(path): Invalid: Not a feather file Traceback:

  1. read_feather("./aFolder/dfwin.feather")
  2. feather(path)
  3. openFeather(path)"

Can someone help me here? The R code I used is below:

library(feather)
dfwin = read_feather('./aFolder/dfwin.feather')```
2 Answers

I had exactly the same problem and I found a solution for it by using arrow package in r. the following code can be used instead of read_feather() from feather library.

arrow::read_feather("./aFolder/dfwin.feather")

I still don't understand why the function from the feather package doesn't work but the same function from arrow package can fix the issue.

Try this

import pyarrow.feather as feather
feather.write_feather(dataframe, filename)

Then use Reza's line of code in R o read the saved feather filename.

Related