Here is a sneaky one: when using
pandas.read_sql() to retrieve the results of a query straight into a
NULL values can end up as
None in your
DataFrame. This will most likely screw up some of your downstream calculations.
NULL values are converted to
pandas.read_sql(). Except when all the values are
NULL in a returned column, because then these will be coerced to
None. Surprise, surprise!
According to this Github issue, the problem is still there (as of
pandas 0.24, at least), and the only workaround is to replace
None with proper
numpy.nan values in the dataframe itself, like
I spent more than an hour figuring this out…