Skip to content Skip to sidebar Skip to footer

Python And Sql : Replacing The Empty Strings Of A Dataframe By A “null” Value Of Sql To Insert The Data In A Database Without Error Of Format

Let's say that I have this dataframe and this code to insert my data in the data base : import pandas as pd import pyodbc REFERENCE = ['GZF882348G', 'SFGUZBJLNJU', 'FTLNGZ242112

Solution 1:

Replace NaN with None

sql_data = df.replace({np.nan:None}).to_numpy().tolist()

Post a Comment for "Python And Sql : Replacing The Empty Strings Of A Dataframe By A “null” Value Of Sql To Insert The Data In A Database Without Error Of Format"