0

My list of arrays looks like this:

[array([3, 4]), array([2.03973687, 3.72090374]), array([1.20622688, 3.16839936]), array([1.63195542, 2.26354843]), array([0.64015479, 2.13575363]), array([1.48074051, 1.59407509])]

It's supposed to represent a list of x and y coordinates with the first entry being x and the second entry being y (e.g for my first array, 3 is x and 4 is y). I want to make a list with just the x coordinates and then a separate one with just the y coordinates. What's the simplest way to do this?

(I'm working with Python btw)

Arya McCarthy
  • 8,554
  • 4
  • 34
  • 56
Solveig
  • 35
  • 9

1 Answers1

3

Let the initial array be arr

array_x = [i[0] for i in arr]
array_y = [i[1] for i in arr]

Extract the first element from each element and append it to a list. Do the same thing for y coordinates too

Tony stark
  • 198
  • 7