Python: form matrix from lists of lists -
i have following data types
a=[1,2,3] b=[['a', 'c'], ['b', 'c'], ['a', 'b']] c=[[0 2] [1 2] [2 1]] i want form new_matrix following output
index new_value1 new_value2 1 1 ['a','c'] [0,2] 2 2 ['b','c'] [1,2] 3 3 ['a','b'] [2,1] where index column has values a list, new_value1 has values b list , new_value2 has values c list. values in iterative order.
any appreaciated.
put variables in dictionary, , create data frame using dictionary:
a = dict( index=[1,2,3], new_value1=[['a', 'c'], ['b', 'c'], ['a', 'b']], new_value2=[[0, 2], [1, 2], [2, 1]] ) pd.dataframe(a)
Comments
Post a Comment