I want to create a list using a numpy array. I want to export the differences of the values in the array and also the first value of this array:
my_array=np.array([1, 4, 10])
Firstly I find out the differences:
differs=np.diff(my_array)
it gives me:
array([3, 6])
But I want to have:
[1, 3, 6]
I tried the following:
sep=[my_array[0], np.diff(my_array)]
But it gives me:
[1, array([3, 6])]
I tried also to convert the array into a list but again I have a sublist and I do not know how to only copy the numbers of that sublist into my main list. To do that i tried:
sep=[my_array[0], [i for i in np.diff(my_array)]]
And it gave me:
[1, [3, 6]]
In advance, I do appreciate any help.