I have a table with different numerical values in the Microsoft SQL database. All columns defined as float
in SQL. Some of the values are NULL as well.
When operating on the data, using the Pandas library (version 0.23.4) in Python (version 3.6), some of the NULL
values are imported as NaN
and some as None
.
One row for example, as observed from within the SQL Management Studio:
NULL, NULL, -1.17, 0.67, 0.42, -0.14, 0.84, -0.30, NULL
Importing with read_sql
I get the below result in Python:
nan, nan, -1.17, 0.67, 0.42, -0.14, 0.84, -0.30, None
I am curious what is the difference from Pandas point of view?
Should I treat the values differently?
I understand that NaN
is treated as a numerical value, allowing faster operations in Pandas, while None
is simply a notion of non-existing object. But why is there an inconsistency?