create dict from two columns pandas

Solutions on MaxInterview for create dict from two columns pandas by the best coders in the world

showing results for - "create dict from two columns pandas"
Erika
29 Sep 2016
1pd.Series(df.A.values,index=df.B).to_dict()
Luigi
30 Nov 2016
1In [9]: pd.Series(df.Letter.values,index=df.Position).to_dict()
2Out[9]: {1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e'}
3
Mckenzie
25 May 2018
1In [6]: df = pd.DataFrame(randint(0,10,10000).reshape(5000,2),columns=list('AB'))
2
3In [7]: %timeit dict(zip(df.A,df.B))
41000 loops, best of 3: 1.27 ms per loop
5
6In [8]: %timeit pd.Series(df.A.values,index=df.B).to_dict()
71000 loops, best of 3: 987 us per loop
queries leading to this page
dataframe two columns to dictionarypandas to dict several columnspandas two column to dictionaryconvert pandas column to dictionary2 columns of df to dictcreate df from dict two columnscreate dictionary from two pandas columnscolumn to dict pandaspython make dictionary out of two columns in dataframepandas dataframe from multiple dictionariestwo columns to pandas dictcreating multiple dictionaries into dataframecreate dataframe from multiple dictionaries pythondictionary in column pandascreate dictionary using multiple columns pandaspython dictionary to 2 columns make dictionary from two dataframe columnscreate dictionary from columns pandaspython dictionary from dataframe columnsdictionary from multiple pandas columnsextract column from dataframe and convert to dictionary pythonpython how to create dict from dataframe based on 2 columnsdataframe to dictionary with one column as key with duplicatespandas make a dictionary from two columnscreate dictionary with two columns pandasdictionary from two columns pandaspandas column read as dictpython make dictionary from two columnspandas faster way to make a dict of two columnsconvert dict column to more columns pandasdict key as column value pandaspython convert a key values from pandas to a dictionary with multiple columnspandas create dictionary from columnconvert two columns to dictionary pandaslist of key value dictionary to two column dataframepandas convert two columns to dictdataframe to dictionary with column name as keycreate a dictionary from columns in a pandas dataframecreate dict column from two columns pandasmake a dictionary of two columns in pandaspandas dictionary from multiple columnsdataframe to dict one column as keycreate dataframe from multiple dictpandas create dict from columncreate a dictionary of few columns pandaspandas create dict out of two columnsdf from dict two columnsturn two pandas columns into dictionarypandas two columsn to dicthow to make a dictionary from two pandas columnsmake a dictionary out of two pandas columnscreate 2 or more dictionary and convert into dataframehow to make a dictionary in python from 2 dataframe columnscreate dataframe from two dictionariestwo columns pandas to dictpandas create dictionary from columnsmake a dictionary from two columns pandasdict to dataframe key as columnconvert pandas dataframe 2 columns to dictionaryturn pandas columns into nested dictpandas to dict with column as key2 column dataframe to dictionarypandas two columns to dictconvert dict to columns pandaspandas key value from two columnsdataframe to dictionary with one column as keytwo dictionary to pandas dataframe2 dict to df pythonmultiple dictionary to dataframeconvert two column dataframe to dictionarycreate dict using two pandas columnspandas 2 columns to dictcreate dict based on two columns pandasconvert a column of dict to two columns pandasappend dictionary to 2 columns in pandas dataframedataframe column is dict turn into columnspandas dataframe from dict both columnszip df into dictkeys and values to columns pandas from dictionarycreate python dictionary from dataframe two columnscreate dictionary from two columns pycreate dictionary from 2 columns of dataframepython dictionary from two columns in dataframe2 columns to dict pandasturn column of dictionaries into columns pandas2 columns of dataframe to dictionarytransform 2 columns in dict pandaspython create a dictionary from two columnscreate dict from two dataframehow to make dictionary from two columnsdict zip pandashow to put multiple dataframes into dicthow to map values from two columns in dataframe and convert to dictpandas update a dictionary from two columnspandas dict column to columnspython create dictionary from two pandas columnspandas columns to dictionarycreate dict from two dataframe columnsdictionary in rows to multiple columns pandasmake dataframe with multiple columns from one dictionaryget a dict from 2 columns pandasturn a dict column into column pandashow to form a dictionary from two columns in pandas dataframecreate dictionary from two series pandaspandas column with dictionary to multiple columnstransform 2 column in a dict from df2 columns to dictionary pandashow to convert a dictionary of two dimensions two a dataframedict to dataframe columns pandas to dict two columnspandas dict column to multiple columnsdictionary to dataframe key as columnpandas dataframe create dictionary from two columnscombine dictionary columns into one pandashow to turn two dataframe column into dictionaryconvert a dataframe column to dictionarytwo column dataframe to dictdataframe columns to dictionarycreate a dictionary from two columns pandascreate dictionary using two columns pandasdataframe from dict columnstwo columns to dictionary pandascreate a dataframe using two dictionaries with same keyspandas two coluns to dictmake a dictionary of 2 columns from a dataframe pythonpandas dataframe to dictionary two columnsstore two columns in dictionary pandasdataframe column to dictionary keypython dict from two columnshow to create a dictionary out of two columns pythondataframe to dict column as key and other as valuecreate dict from 2 df columnscreate dataframe from multiple dict as new cilumnpython dictionary to 2 columns dataframepandas create dataframe from multiple dictionariestwo columns to dixt pandaspython dataframe two columns to dictionarypython dictionary in pandas coloumn to multiple columnscreate dataframe from dict key value two columnsconvert 2 columns to dictionary pandastransform values column with dictionary pandaspandas dataframe to dictionary with one column as key and other as listdict code for two columnstwo dicts to dataframeturn two columns of dataframe to dictmake dict from two columns pandasmultiple dict to dataframeconvert two column to dict pythonturn dataframe to dict two columnsconvert column of dicts to multiple columns pandas dataframepd two columns to dictcreate dict from two columns pandaspandas create dictionary from multiple columnshow to take 2 columns from a dataframe and make a dictionarypandas dataframe to dictionary column as keytwo pandas columns to dictadd dictionary to pandas dataframe as 2 columnspanda convert column to python dictionarymake diction from two columns pythonmake dictionary from two columns pandaskeys and values to columns pandascolumns to dictionary pandaspandas dataframe to dict two columnspandas dictionary from two columnscreate dict from 2 pandas columnsdictionary with 2 columnspandas dict key as columnexpand two columns of dictionaries pandascreate dataframe from multiple dictionariestwo columns to dict pythonsdict to datafrmae with key as one column and vlaues as ohter columnconvert one column with dictionary value to multiple columns in pandashow to create 2 dataframe columns from dictionarymake dictionary from pandas columnspandas dict from two columnspandas dictionary to dataframe key as columnconvert column of dictionaries to dataframepandas create dictionary from two columnsdictionary from 2 pandas columnsmultiple dicts to dataframeconvert python columns to dictionarypython multiple dictionary to dataframeturn a dictionary int a two column dataframeexpand two columns of dictionary pandaspython dictionary to dataframe two columnspython how to make a dictionary from pandas dataframe using 2 columnsconvert all columns of dataframe to dictionarydictionary from dataframe columnspandas combine two columns into dictpython dictionary to df two columnscreate a dict base on 2 columns df pandascreating a dictionary with two seriesstore multiple dict to dataframecreate dictionary from two columns pandas make 2 column df from dictcreate dictionary with some columns pandas dataframehow to create a dictionary in python from two columnsdataframe with two columns to dictionarymake df 2 columns to dicttwo columns pandas to dictioanrytwo columns to dict pythondictionary dataframe two columnsconvert pandas 2 columns to dictionarymultiple column dataframe from dictionarydf two columns to dictionarycreating a dict of combined cols in pandaspython create dictionary from two columnstwo columns sf to dict pythonpandas convert column of dictionary to columnsdictionary from 2 columns pandas2 columns to dictpandas map by two columns dictionaryhow to make a column as dictionary of two columns pandaspandas map column using two dictionary dictionary from two pandas columnscreate a dictionary three columns pandastwo column to dict pandasdataframe to dictionary by multiple columns as keys and rows as valuespandas using 2 columns make dictionarypython dictionary to dataframe key as columnpandas one column to multiple key value dictionaryconverting two df columns to dict key valueconvert a column of dict to two columnspandas creat dictionary from two columnspython multiple columns dictionarydictionary to dataframe columnsdataframe to dictionary column as keypandas 2 column to dictpandas dataframe to dict with column as keypandas subtract two columnscreate dictionary out of two columns pandasdf to dict two columnsdataframe to dict two columnsdictionary using two seriespython dict to df columndictionary using 2 columnsdictionary with two pandas columnspandas dictionary in two columns to seriescolumn to dict pandas colnamesdict from two columns pandaspython dict from two columns pandasdictionary to columnpandas dictionary column to multiple columnshow to create a dictionary from two columns in pandas dataframetwo columns in dataframe to dictionarypandas make one column as dict key and another valuepython create dictionary from two dataframe columnspandas create dictionary of 2 columnspandas columns into dictionaryreturn 2 columns as dictionary pandaspandas convert two columns to dictionarypandas to dict column as keydf to dict column as keycreate dictionary from 2 columns pandasconvert two dataframe column into dictionarytwo dataframe columns to dictionarycoombination of two columns as key in dictionaries in pythoncreate dictionary from a columnmerge multiple dictonies in pandas dataframepandas dataframe dict from two columnscreate dict from two columns pandas