How to set missing value in dataframe.csv(sys.stdout, na_rep='NULL') for the first row of dataframe containing column headers(the highlighted portion)

Set missing value

Tried data.to_csv(sys.stdout,na_rep=’NULL’) but it doesnt apply to first row

>Solution :

That’s your index‘s name – it cannot be ignored.

Set index name instead using = 'yourname' or remove the index from the to_csv using df.to_csv(index=False)

Leave a Reply