I have a coordinates dataframe with 2 columns X and Y:
X Y
56 89
59 90
58 95
53 89
56 63
59 78
Now i want to create a List of List containing the coord. in this way to perform futher operations:
list = [(56, 89), (59, 90), (58, 95), (53, 89),....
Thanks for the help
>Solution :
This should do what you want with your example:
[(x, y) for x, y in zip(df["X"].values, df["Y"].values)]
zip
accepts more than two list
s, so you can easily adapt this code to, say, 3 or more coordinates (or any other column in your dataframe).