i want to convert a columns(Azi_0 to Azi_47,Dist_0 to Dist_47) in dataframe(df) to a two column(Azimuth,Distance) as in new_df?
Azi = [f"Azi_{i}" for i in range(47)]
dist = [f"Dist_{i}" for i in range(47)]
expected output,new_df:
Current_Sim_Az_obj1 | Current_Sim_distance_r_obj1 | Azimuth | Distance |
---|---|---|---|
-60 | 3.950372041 | -59.73007665 | 3.07 |
-60 | 3.950372041 | -59.73007665 | 3.07 |
-60 | 6.950372041 | -59.4701257 | 7.89 |
-60 | 6.950372041 | -59.89004647 | 7.765 |
-60 | 8.950372041 | -59.64009363 | 8.345 |
-60 | 8.950372041 | -59.58010495 | 8.425 |
-60 | 8.950372041 | -59.58010495 | 8.425 |
-55 | 2.38397709 | -55.06095763 | 3.14 |
-55 | 2.38397709 | -55.21092934 | 3.065 |
-55 | 2.38397709 | -55.21092934 | 3.065 |
-55 | 2.38397709 | -55.2609199 | 3.03 |
-55 | 2.38397709 | -55.2609199 | 3.03 |
-55 | 2.38397709 | -55.2609199 | 3.03 |
-55 | 2.38397709 | -55.2609199 | 3.03 |
-55 | 2.38397709 | -55.03096329 | 3.105 |
-55 | 2.38397709 | -55.03096329 | 3.105 |
-55 | 2.38397709 | -55.32090858 | 3 |
-55 | 2.38397709 | -55.32090858 | 3 |
-55 | 2.38397709 | -55.27091802 | 3.12 |
-55 | 2.38397709 | -55.27091802 | 3.12 |
-55 | 2.38397709 | -55.8508086 | 3.09 |
-55 | 2.38397709 | -55.8508086 | 3.09 |
-55 | 2.38397709 | -55.57086142 | 3.065 |
-55 | 2.38397709 | -55.57086142 | 3.065 |
How to combine several columns to a single column?