read_sql_query type cast

22 views
Skip to first unread message

Andrea Cassioli

unread,
Dec 13, 2016, 5:26:25 AM12/13/16
to PyData
Dear all,
before filing a bug report (that takes time..) I want to understand whether I am something wrong.

Here the issue:

* I am reading a table from a database using read_sql_query. 
* The table contains several string columns that may be NULL
* The resulting dataframe promote some of those columns to Object, even if no NULLs are among the columns.

That is very annoying. And I cannot see why.Does pandas applies type cast just because the columns are possibly NULL? 


Thanks,

Pietro Battiston

unread,
Dec 13, 2016, 6:00:34 AM12/13/16
to pyd...@googlegroups.com
Dear Andrea,

does this answer answer?
http://stackoverflow.com/a/21020411/2858145

Or is there anything more I am missing?

Pietro
> -- 
> You received this message because you are subscribed to the Google
> Groups "PyData" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to pydata+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Andrea Cassioli

unread,
Dec 13, 2016, 6:16:48 AM12/13/16
to PyData
Hi Toobaz,
thank you for the quick reply. Yes, that is was I was looking too.
Reply all
Reply to author
Forward
0 new messages