1

I used conda install pyarrow to install pyarrow in Spyder launched through Anaconda navigator. But I received the following error after I try to save a file in feather format.

Traceback (most recent call last): File "", line 1, in pyarrow.feather.write_feather(df,"/Users/omg/Downloads/testFeather.ftr") AttributeError: module 'pyarrow' has no attribute 'feather'

The code is

import pandas as pd
import pyarrow

tempArr = np.reshape(np.zeros(10), (5,2))
tempArr += 1
df = pd.DataFrame(tempArr, columns=['a', 'b'])
pyarrow.feather.write_feather(df,"/Users/omg/Downloads/testFeather.ftr")

versions are: pyarrow.version '0.11.1' np.version '1.18.1'

pd.version '1.0.3'

L.Yang
  • 553
  • 1
  • 6
  • 12
  • 1
    Your `pyarrow` version is quite old, try updating to 0.17 (or at least 0.15+) – Uwe L. Korn May 27 '20 at 12:17
  • One thing is that conda, even use forge, will only find version up to 0.11. I forced to install 0.15. Perhaps conda should fix that too. – L.Yang May 27 '20 at 18:47
  • 1
    conda-forge has the recent pyarrow=0.17.1, if it isn't installed in your environment, you probably have another outdated package that references pyarrow=0.11. – Uwe L. Korn May 28 '20 at 05:51

1 Answers1

2

feather is a module inside pyarrow. This should work:

import pandas as pd
from pyarrow import feather
import numpy as np

tempArr = np.reshape(np.zeros(10), (5,2))
tempArr += 1
df = pd.DataFrame(tempArr, columns=['a', 'b'])
feather.write_feather(df,"testFeather.ftr")
NYC Coder
  • 7,424
  • 2
  • 11
  • 24