What Type Of Data In Csv Will Be Null After Load In Mysql And Pandas
I have a csv file which contain the null values. They represent in three format the blank between two comma, that is ,, the NaN between two comma, that is ,NaN, the NA between
Solution 1:
So how can i load data into mysql table and make them into null ?
You can use LOAD DATA INFILE
to import the csv data to MySQL
table. But the kind of modification in your data, you are looking for should be best done using a script.
Create a script and replace all those empty string, NAN
and NA
to NULL
or just empty string in your csv file and then use that modified csv file to import to your database. Regular Expression is the option you have.
Again, depending on which OS you are using; you can do that using a single command like using sed
on linux
sed 's/NAN//g' myData.csv > myNewData.csv
(OR) If Windows OS then take a look here Replace specific text in csv via commandline
Post a Comment for "What Type Of Data In Csv Will Be Null After Load In Mysql And Pandas"