I have a csv file that looks like this
col1,col2,col3,col4,col5
value1,value2,value3,value4,value5
,,value6,value7,value8
,,value10,value11,value12
I would need to insert values in the empty cells.
I am reading the data with pandas like this
import pandas as pd
data = pd.read_csv(file).fillna('yellow', 'blue')
any sugestions?
Update: the error is solved The rows in my csv where an editing mistake. The main problem is how to write in to the empty cells custom values.
Expected result
col1,col2,col3,col4,col5
value1,value2,value3,value4,value5
yellow,blue,value6,value7,value8
yellow,blue,value10,value11,value12
actual result
col1,col2,col3,col4,col5
value1,value2,value3,value4,value5
NaN,NaN,value6,value7,value8
NaN,NaN,value10,value11,value12
Initial problem -> Solved
I am getting an error like this:
pandas.errors.ParserError: Error tokenizing data. C error: Expected 5 fields in line 3, saw 6