column wise dictionary creation using python
Question: How to make a columnwise dictionary from csv using python?

    
    
    name, lastname, hobby
    jhon, g, fishing
    mike, a, boxing
    tom, v, sking
    

output should be :

    
    
    name = {1 : 'jhon', 2:'mike', 3:'tom'}
    lastname = {1 : 'g', 2:'a', 3:'v'}
    hobby = {1 : 'fishing', 2:'boxing', 3:'sking'}
    


Answer: Using [pandas](http://pandas.pydata.org/) you can get both list or dictionary
very easily:

    
    
    >>> import pandas as pd
    >>> from StringIO import StringIO
    >>> csvfile = StringIO('''name, lastname, hobby
    ... jhon, g, fishing
    ... mike, a, boxing
    ... tom, v, sking''')
    >>> 
    >>> df = pd.read_csv(csvfile)
    >>> dict(df['name'])
    {0: 'jhon', 1: 'mike', 2: 'tom'}
    >>> list(df['name'])
    ['jhon', 'mike', 'tom']
    

