DOC: pandas.DataFrame.to_sql
does not document that it creates a table index for index columns
#54712
Closed
1 task done
Labels
Pandas version checks
main
hereLocation of the documentation
https://pandas.pydata.org/docs/dev/reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql
Documentation problem
As far as I can tell,
pandas.DataFrame.to_sql
creates a table index when creating a table and including the index of the dataframe. This is unexpected, and undocumented. See this line that I believe is responsible for this. Here's a link to the relevant SQLAlchemy docs for that constructor input.Suggested fix for documentation
I'd recommend updating the text field for the
index
input:Or something like that. I DO think that this behavior is generally undesired and should be removed, or have an input that should default to False, but at least documenting it will save others from hours of time looking through the code base to figure this out.
The text was updated successfully, but these errors were encountered: