How to tell pandas to ignore incorrect dictionary items in list?
For case of simplicity, if I have case from 1st version solution from previous question:
L =[['Manufacturer: Hyundai',
'Model: Tucson',
'Mileage: 258000 km',
'Registered: 07/2019'],
['Manufacturer: Mazda',
'Model: 6',
'Year: 2014',
'Registered: 07/2019',
'Comfort',
'Safety']]
df = pd.DataFrame([dict(y.split(':') for y in x) for x in L])
print (df)
Second dict item have 2 last items missing values ('Comfort' and 'Safety') but they are also missing ":" therefore pandas is throwing :
ValueError: dictionary update sequence element #5 has length 1; 2 is required
How to tell pandas to ignore these type of errors and proceed with parsing of list?