Reputation: 51
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
Upvotes: 0
Views: 20
Reputation: 8811
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)]
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
Upvotes: 1