Re: Python mysql-connector doesn't handle numpy.nan
Hi Berel,
If possible, can you share a representative code snippet of how you are executing the insertions?
I myself have run a little experiment using a float numbers matrix (with some missing, a.k.a. numpy.nan). For testing purposes, I loop over each row (float number vector) and insert it into a table where its columns were defined as FLOAT at table creation time. For insertion, I used the cursor.execute() method.
When inserting matrix:
x1, y1, NaN
NaN, y2, z2
I get the following after fetching all from my dummy table using the connector:
[(x1, y1, None), (None, y2, z2)]
Finally, on the server side, it looks like
+----+------+-------+-------+
| id | x | y | z |
+----+------+-------+-------+
| 1 | x1 | y1 | NULL |
| 2 | NULL | y2 | z2 |
+----+------+-------+-------+
This result looks good to me.
Some notes:
- I am not using the fastest way of insertions since I want to prove the concept first.
- I understand there are many ways to do insertions, that's why I am curious to see yours.