Skip to content
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
2 changes: 2 additions & 0 deletions doc/source/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ Bug Fixes
- Fixed a bug with setting invalid or out-of-range values in indexing
enlargement scenarios (:issue:`4940`)
- Tests for fillna on empty Series (:issue:`4346`), thanks @immerrr
- Fixed a bug where ``ValueError`` wasn't correctly raised when column names
weren't strings (:issue:`4956`)

pandas 0.12.0
-------------
Expand Down
4 changes: 3 additions & 1 deletion pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3033,7 +3033,9 @@ def create_axes(self, axes, obj, validate=True, nan_rep=None,
new_blocks.append(b)
except:
raise ValueError(
"cannot match existing table structure for [%s] on appending data" % ','.join(items))
"cannot match existing table structure for [%s] on "
"appending data" % ','.join(com.pprint_thing(item) for
item in items))
blocks = new_blocks

# add my values
Expand Down
15 changes: 15 additions & 0 deletions pandas/io/tests/test_pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3696,6 +3696,21 @@ def test_store_datetime_mixed(self):

# self.assertRaises(Exception, store.put, 'foo', df, format='table')

def test_append_with_diff_col_name_types_raises_value_error(self):
df = DataFrame(np.random.randn(10, 1))
df2 = DataFrame({'a': np.random.randn(10)})
df3 = DataFrame({(1, 2): np.random.randn(10)})
df4 = DataFrame({('1', 2): np.random.randn(10)})
df5 = DataFrame({('1', 2, object): np.random.randn(10)})

with ensure_clean('__%s__.h5' % tm.rands(20)) as store:
name = 'df_%s' % tm.rands(10)
store.append(name, df)

for d in (df2, df3, df4, df5):
with tm.assertRaises(ValueError):
store.append(name, d)


def _test_sort(obj):
if isinstance(obj, DataFrame):
Expand Down