Using Python to Read Rows of CSV Files With Column Content containing Comma
Question: I am trying to parse this CSV and print out the various columns separately.

However my code is having difficulty doing so possibly due to the commas in
the addresses, making it hard to split them into 3 columns.

How can this be done?

**Code**

    
    
    with open("city.csv") as f:
        for row in f:
            print row.split(',')
    

**Result**

    
    
    ['original address', 'latitude', 'longitude\n']
    ['"2 E Main St', ' Madison', ' WI 53703"', '43.074691', '-89.384168\n']
    ['"Minnesota State Capitol', ' St Paul', ' MN 55155"', '44.955143', '-93.102307\n']
    ['"500 E Capitol Ave', ' Pierre', ' SD 57501"', '44.36711', '-100.346342\n']
    

**city.csv**

    
    
    original address,latitude,longitude
    "2 E Main St, Madison, WI 53703",43.074691,-89.384168
    "Minnesota State Capitol, St Paul, MN 55155",44.955143,-93.102307
    "500 E Capitol Ave, Pierre, SD 57501",44.36711,-100.346342
    


Answer: If you just want to parse the file, I would recommend using [Pandas
Library](http://pandas.pydata.org/)

    
    
    import pandas as pd
    data_frame = pd.read_csv("city.csv")
    

which gives you a data frame that looks like this in iPython notebook.
[![resulting data
frame](http://i.stack.imgur.com/ZPW6j.png)](http://i.stack.imgur.com/ZPW6j.png)

