Skip to content

BUG: fix writing of Categorical with to_sql (GH8624) #8682

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

Conversation

jorisvandenbossche
Copy link
Member

Closes #8624

Use .get_values() instead of .values on the block,
this ensures that NonConsolidatable blocks (non-dense
blocks like categorical or sparse) are densified
instead of just returning the raw .values.

@jorisvandenbossche jorisvandenbossche added the IO SQL to_sql, read_sql, read_sql_query label Oct 30, 2014
@jorisvandenbossche jorisvandenbossche added this to the 0.15.1 milestone Oct 30, 2014
@jreback
Copy link
Contributor

jreback commented Oct 30, 2014

needs big doc note that these are converted to object on serialization (to reading back does NOT generate a categorical)

@jorisvandenbossche
Copy link
Member Author

yes, OK, in the io.rst docs for sql?

@jreback
Copy link
Contributor

jreback commented Oct 30, 2014

needs big doc note that these are converted to object on serialization (to reading back does NOT generate a categorical)

Use .get_values() instead of .values on the block,
this ensures that NonConsolidatable blocks (non-dense
blocks like categorical or sparse) are densified
instead of just returning the raw .values
@jorisvandenbossche
Copy link
Member Author

@jreback added a doc note.

jorisvandenbossche added a commit that referenced this pull request Oct 31, 2014
BUG: fix writing of Categorical with to_sql (GH8624)
@jorisvandenbossche jorisvandenbossche merged commit 387c9bf into pandas-dev:master Oct 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO SQL to_sql, read_sql, read_sql_query
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pd.to/read_sql_table silently corrupts Categorical columns
2 participants