pandas.read_feather got an unexpected argument nthreads
Asked Answered
S

2

11

I tried saving a dataframe to feather format but while loading back I got the error

os.makedirs('tmp', exist_ok=True)
df_hist.to_feather('tmp/historical-raw')

Here's the loading back into the dataset

df_hist= pd.read_feather('tmp/historical-raw')

which gives the following error

read_feather() got an unexpected keyword argument 'nthreads'

Thanks in advance

Sannyasi answered 1/1, 2019 at 13:41 Comment(3)
Have you tried updating your pandas and pyarrow installations? There are some workarounds offered here.Bahaism
Which version of pandas you are running with?Oralee
@pygo I am running the latest version. Tried updating but requirement already satisfiedSannyasi
A
14

Try replacing below line

df_hist= pd.read_feather('tmp/historical-raw') 

with

import feather
df_hist=feather.read_dataframe('tmp/historical-raw')

above change worked for me

Albumin answered 2/1, 2019 at 9:51 Comment(0)
S
2

read_feather function is as follows:

feather = _try_import()
path = _stringify_path(path)

if feather.__version__ < LooseVersion('0.4.0'):
    return feather.read_dataframe(path)

return feather.read_dataframe(path, nthreads=nthreads)

The read_feather function calls the feather.read_dataframe inturn. You can import feather and call feather.read_dataframe('path') directly.

import feather
feather.read_dataframe(path)
Sosthina answered 10/1, 2019 at 7:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.