Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python how to create dict from dataframe based on 2 columns

In [9]: pd.Series(df.Letter.values,index=df.Position).to_dict()
Out[9]: {1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e'}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #create #dict #dataframe #based #columns
ADD COMMENT
Topic
Name
1+3 =