I have a variable var
When I print it in jupyter, it gives:
var
#array([list([9166855000000.0, 13353516.0]),
# list([7818836000000.0, 11389833.0]),
# list([20269756000000.0, 29527304.0]),
# list([66886956000000.0, 97435384.0]),
# list([58686560000000.0, 85489730.0]),
# list([50809440000000.0, 74014984.0])], dtype=object)
or
print(var)
[list([9166855000000.0, 13353516.0])
list([7818836000000.0, 11389833.0])
list([20269756000000.0, 29527304.0])
list([66886956000000.0, 97435384.0])
list([58686560000000.0, 85489730.0])
list([50809440000000.0, 74014984.0])]
The type is:
print(type(var))
#<class 'numpy.ndarray'>
How can I devide the second elements of the sublists by the first ones?
I want to get the following values as an array or list:
13353516.0/9166855000000.0
...
74014984.0/50809440000000.0
np.stack(var)(orvstack) to make a 2d array. Otherwise you'll need to use a list comprehension to iterate through the lists, and select the desired value.