Skip to content

BUG: to_sql convert index name to string (#15404) #15423

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 4 commits into from
Feb 17, 2017
Merged
Changes from 1 commit
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
Next Next commit
Converted index name to string to fix issue #15404 - BUG: to_sql erro…
…rs with numeric index name - needs conversion to string
  • Loading branch information
redbullpeter committed Feb 16, 2017
commit 73d20c04ef88040e5716d22f29aa19734c74d1f5
2 changes: 1 addition & 1 deletion pandas/io/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ def _get_column_names_and_types(self, dtype_mapper):
for i, idx_label in enumerate(self.index):
idx_type = dtype_mapper(
self.frame.index.get_level_values(i))
column_names_and_types.append((idx_label, idx_type, True))
column_names_and_types.append(((text_type(idx_label)), idx_type, True))

column_names_and_types += [
(text_type(self.frame.columns[i]),
Expand Down