1
votes

I have a csv file with data :

 A   B        C    D            E        F
"1"|"6A-7A"|"MFF" ||     "KEY"        |"Y"
"2"|"n/a"  | ""   |"n/a" | "INVENTORY"|"Y"

where the cell value of 1st row in D column is null,

When I try to read it using Pandas:

df =  pd.read_csv('test.csv', keep_default_na=False, skip_blank_lines=True)

I get the output:

A   B        C    D            E        F
1  6A-7A    MFF               KEY       Y
2  n/a           n/a       INVENTORY    Y

where the Null value is printed as blank space.

The desired output is:

A   B        C    D            E        F
1  6A-7A    MFF  NaN          KEY       Y
2  n/a           n/a       INVENTORY    Y

How to achieve this?

Can you copy raw data in the csv file to reproduce? - Space Impact