Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: A zero length series written to HDF cannot be read back. #4708

prossahl opened this issue Aug 30, 2013 · 0 comments


None yet
1 participant
Copy link

commented Aug 30, 2013

This happens with and empty series with numpy arrays for both the values and the index.

>>> import pandas as pd
>>> import numpy as np
>>> with pd.get_store('foo.h5') as store:
...     s = pd.Series(np.array([], dtype=np.int64), index=np.array([], dtype=np.int64))
...     store['s'] = s
...     s = store['s']
Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
  File "/users/is/pross/workspace/pandas/git/pandas/pandas/io/", line 349, in __getitem__
    return self.get(key)
  File "/users/is/pross/workspace/pandas/git/pandas/pandas/io/", line 507, in get
    return self._read_group(group)
  File "/users/is/pross/workspace/pandas/git/pandas/pandas/io/", line 1093, in _read_group
  File "/users/is/pross/workspace/pandas/git/pandas/pandas/io/", line 2247, in read
    return Series(values, index=index,
  File "/users/is/pross/workspace/pandas/git/pandas/pandas/core/", line 657, in __init__
    data = SingleBlockManager(data, index, fastpath=True)
  File "/users/is/pross/workspace/pandas/git/pandas/pandas/core/", line 2942, in __init__
    block = make_block(block, axis, axis, ndim=1, fastpath=True)
  File "/users/is/pross/workspace/pandas/git/pandas/pandas/core/", line 1535, in make_block
    return klass(values, items, ref_items, ndim=ndim, fastpath=fastpath, placement=placement)
  File "/users/is/pross/workspace/pandas/git/pandas/pandas/core/", line 62, in __init__
    % (len(items), len(values)))
ValueError: Wrong number of items passed 1, indices imply 0

I have fixed this locally and will put in a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.