We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0fbd19b commit 98afb7fCopy full SHA for 98afb7f
modin/pandas/base.py
@@ -3360,9 +3360,13 @@ def to_sql(
3360
new_query_compiler = self._query_compiler
3361
# writing the index to the database by inserting it to the DF
3362
if index:
3363
- if not index_label:
3364
- index_label = "index"
3365
- new_query_compiler = new_query_compiler.insert(0, index_label, self.index)
+ new_query_compiler = new_query_compiler.reset_index()
+ if index_label is not None:
+ if not is_list_like(index_label):
3366
+ index_label = [index_label]
3367
+ new_query_compiler.columns = list(index_label) + list(
3368
+ new_query_compiler.columns[len(index_label) :]
3369
+ )
3370
# so pandas._to_sql will not write the index to the database as well
3371
index = False
3372
0 commit comments