-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
Add dtype keyword to read_sql_query to control per column dtypes. #10285
Comments
This can be done equivalent to the |
TomAugspurger
changed the title
Add control over types in read_sql_query (to resolve NULL inconsistency)
Add dtype keyword to read_sql_query to control per column dtypes.
Jun 6, 2019
This was referenced Jun 6, 2019
take |
5 tasks
@avinashpancham Looks like this happens with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When reading from SQL queries - especially when reading chunk-wise - issues with type conversion can occur.
It would be ideal if one could specify the types of the columns, so that type conversions go right.
A very common case is reading pure float results chunk-wise from a large table. The nuisance comes in when and chunk contains NULL values only in a column. In such cases these NULL values are stored as
None
rather thanfloat("nan")
. I see that this is an issue with inconsistent NULL types in pandas and missing type information in read_sql_query.Another case could be when text columns happen to contain numbers only in a chunk.
Specifying types for a query manually could resolve these issues.
The text was updated successfully, but these errors were encountered: