Skip to content
Advertisement

Python import csv to dict

Excuse me. I am a noob I saw Python import csv to list Pandas #2

if I have this csv

JavaScript

How to change like this

JavaScript

I just can do like this

JavaScript

result:

JavaScript

Advertisement

Answer

Almost there. Little change to your code. Notice the keyword argument ‘orient’.

JavaScript

It gives the following output

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement