Having data as below:
my_list=[(B_BC,0.3140561085683502, 0.27612272457883213)
(BR_BR,0.1968307181527823, 0.18806346643096217)]
I need to convert this to data frame with 3 column. First Column with location and second and third column should be a and b.
Expected Output
CodePudding user response:
I am assuming you are using Python, then this would work
my_list=[('B_BC',0.3140561085683502, 0.27612272457883213),
('BR_BR',0.1968307181527823, 0.18806346643096217)]
print(my_list)
import pandas as pd
df = pd.DataFrame(my_list, columns = ['Location','A','B'])
print(df)
Location A B
B_BC 0.314056 0.276123
BR_BR 0.196831 0.188063