I started working with CSV files in Python and I want to learn how to manipulate them correctly. I want to learn how to manage large amounts of data such this CSV file found here Sacramento Crime January 2006 with 7,548 crime records.
Basically I want to turn it into a table containing the first row as header (name, ID, latitude etc.) and all other values under it. I used the code from this question which is similar to mine but does not work entirely.
According to that question I should have the name of the header followed by its contents but I get:
{'address': [], 'etc': []} []
When I should be getting {{'adress':[]]} ['addresses in CSV file( 7k etc)']
Also it is all in one line when I want it to look like
Name ID Latitude etc
John 55 -4.56777 etc
whilst all my CSV file is like this:
cdatetime,address,district,beat,grid,crimedescr,ucr_ncic_code,latitude,longitude
1/1/06 0:00,3108 OCCIDENTAL DR,3,3C
Currently I only have worked on what is found in the answer of the linked question but I have been struggling for a while to find a way. By the way I am really new to Python, as in I just learned how to open, read, write files etc.
Also should I be using import pandas
or import csv
. Which is better?