I need help for my project. I have an array that look like this?
rndm = [[0 1]
[0 0]
[0 0]
[0 1]]
Now, I want to add par_1 = [[1 0]], par_2 = [[0 0], ch1 = [[1 1]], and ch2 = [[0 1]] to rndm.
My code looks like this:
new_rndm = []
new_rndm.append(par_1)
new_rndm.append(par_2)
new_rndm.append(ch1)
new_rndm.append(ch2)
# add them to rndm
rndm = numpy.append(rndm, [new_rndm])
print(rndm)
The output gives me something like this:
rndm = [0 1 0 0 0 0 0 1 1 0 0 0 1 1 0 1]
What I am expecting as my out put is:
rndm = [[0 1]
[0 0]
[0 0]
[0 1]
[1 0]
[0 0]
[1 1]
[0 1]]
I think the problem is that append cannot be used in arrays. If correct, anyone help me what other function I could try? If not, kindly educate me. I am very much willing to learn. Thank you!
nested listor anumpy array?