Is there any simple and fast way in pandas to reach from df
d = {'points': ['P1', 'P2', 'Q1', 'Q2', 'Q3'],
'x': [1, 2, 60 , 61, 62],
'y': [2, 5, 70 , 71, 72]
}
pd.DataFrame(data=d, index=[0, 1, 2, 3, 4])
to df
d = {'points': ['all_P', 'all_Q'],
'x1' : [1,60],
'y1' : [2,70],
'x2' : [2,61],
'y2' : [5,71],
'x3' : [pd.NA , 62],
'y3' : [pd.NA , 72]
}
pd.DataFrame(data=d, index=[0, 1])