I have a CSV file (staff) that looks like this:
id, name, title
1, Steve, Customer Service Manager
2, Martin, Warehouse Operator
3, Jonathan, Backend Developer
I want to parse this into the format:
staff = {
'1':[{'name':'Steve'}, {'title':'Customer Service Manager'}],
'2':[{'name':'Martin'}, {'title':'Warehouse Operator'}],
'3':[{'name':'Jonathan'}, {'title':'Backend Developer'}]
}
But as far as I can tell, the csvreader and pandas libraries don't support this type of operation. Is there a clean way to do this, perhaps with comprehension?