I have a question about taking an element within a numpy array and resizing it in a loop.
The basic issue is that I have a time series in the format (x,y) with some elements that are missing y values so they are read into the program as being of length one.
ie: [x,y] [x,y] [x] [x,y]
So i need to take these occasional points and resize them to the standard (1,2) (and then generate a point based of a distribution but that isn't the trouble). I am aware of the numpy.resize function, but when I try:
for element in list:
if len(element)==1:
element=n.resize(element,(1,2))
it works within the scope of the loop but if I print the list all of the elements are the same as if the loop never occurred. The resize function returns an array so I'm confused as why setting the element of list equal to that array does not work.
Edit: I found a simple solution using regular python lists:
for element in list:
if len(element)==1:
element.append(0)
But I am still curious as to why the above doesn't work, because certainly setting an element equal to something is possible. Or can you only set element[i] equal to something in a [1,x] array?