Skip to content

BUG: HDFStore bug when appending to a table, .typ not recreated on subsequent appends #3126

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

Merged
merged 1 commit into from
Mar 21, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,10 @@ def set_kind(self):
elif self.dtype.startswith('bool'):
self.kind = 'bool'

# set my typ if we need
if self.typ is None:
self.typ = getattr(self.description,self.cname,None)

def set_atom(self, block, existing_col, min_itemsize, nan_rep, **kwargs):
""" create and setup my atom from the block b """

Expand Down
9 changes: 9 additions & 0 deletions pandas/io/tests/test_pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,15 @@ def check_col(key,name,size):
result = store.select('df')
tm.assert_frame_equal(result, df)

with ensure_clean(self.path) as store:

# infer the .typ on subsequent appends
df = DataFrame(dict(A = 'foo', B = 'bar'),index=range(10))
store.remove('df')
store.append('df', df[:5], min_itemsize=200)
store.append('df', df[5:], min_itemsize=200)
tm.assert_frame_equal(store['df'], df)

def test_append_with_data_columns(self):

with ensure_clean(self.path) as store:
Expand Down