MySQL Forums
Forum List  »  Connector/Python

Python mysql-connector doesn't handle numpy.nan
Posted by: Berel Levy
Date: August 16, 2022 03:41PM


My workflow requires that I bulk insert pandas dataframes to a mysql database.

pandas uses numpy.nan to represent null values in a dataframe's float columns.
Unfortunately, when converting said values to a query, the mysql-connector converts numpy.nan to a string; 'nan', failing to insert it to the float column in the db.

I have a code workaround where I replace all numpy.nan values with None, but that is compute intensive and takes up much more space.

Is it possible to open a pull request on mysql-connector github to fix this?

Options: ReplyQuote

Written By
Python mysql-connector doesn't handle numpy.nan
August 16, 2022 03:41PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.