A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/16583 below:

TypeError when reading a Series with read_hdf(mode='r') from fixed format · Issue #16583 · pandas-dev/pandas · GitHub

Code Sample, a copy-pastable example if possible
import tempfile
import pandas as pd

series = pd.Series([1, 2, 3])
with tempfile.NamedTemporaryFile() as tf:
    series.to_hdf(tf.name, 'data', format='fixed')
    result = pd.read_hdf(tf.name, key='data', mode='r')
assert (result == series).all()
[...]/site-packages/pandas/io/pytables.py in read_index(self, key, **kwargs)
   2453             return self.read_sparse_intindex(key, **kwargs)
   2454         elif variety == u('regular'):
-> 2455             _, index = self.read_index_node(getattr(self.group, key), **kwargs)
   2456             return index
   2457         else:  # pragma: no cover

TypeError: read_index_node() got an unexpected keyword argument 'mode'
Problem description

For some inexplicable reason, pd.read_hdf opens files in append mode rather than read-only, so I pass mode='r'. For 'table' format, and also for DataFrame data in 'fixed' format, this works fine, but for Series data in 'fixed' format there is a TypeError

Output of pd.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.6.1.final.0 python-bits: 64 OS: Linux OS-release: 4.8.0-53-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_GB.UTF-8

pandas: 0.20.1
pytest: 3.1.1
pip: 9.0.1
setuptools: 27.2.0
Cython: None
numpy: 1.11.3
scipy: None
xarray: None
IPython: 6.0.0
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: None
tables: 3.3.0
numexpr: 2.6.2
feather: None
matplotlib: None
openpyxl: 2.4.7
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4