1. 程式人生 > >[bug] "TypeError: read_feather() got an unexpected keyword argument 'nthreads'"

[bug] "TypeError: read_feather() got an unexpected keyword argument 'nthreads'"

when running this cell

pd.read_feather('tmp/bulldozers-raw')

I got this error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-83-11476d87a470> in <module>()
----> 1 pd.
read_feather('/home/hamede/fastai/data/tmp/bulldozers-raw') ~/anaconda3/envs/fastai/lib/python3.6/site-packages/pandas/io/feather_format.py in read_feather(path, nthreads) 110 return feather.read_dataframe(path) 111 --> 112 return feather.read_dataframe(path, nthreads=nthreads) TypeError: read_feather(
) got an unexpected keyword argument 'nthreads'

In this post, someone suggested it’s because of pandas version lower than 0.21 as n_threads was added after that version according to the documentation.

Signature: pd.read_feather(path, nthreads=1)
Docstring:
Load a feather-format object from the file path

.
. versionadded 0.20.0 Parameters ---------- path : string file path, or file-like object nthreads : int, default 1 Number of CPU threads to use when reading to pandas.DataFrame .. versionadded 0.21.0 Returns -------

But I got pandas version 0.23.4, so that didn’t work for me. Other answers suggested replacing the broken line with

import feather
df_raw = feather.read_dataframe('tmp/bulldozers-raw')

That worked for me.