I have a matrix which is built at the start of the class and then I go on and use within a couple of functions then at the last function I want to delete a row from the matrix without having to use a new variable name for it otherwise I would have to change every single function call (it loops until a winner is found). It sort of works like this
matrix defined
...a lot of functions that use it then winner is called
def winner():
if hasWon():
.....
else:
fun1()
def fun1():
.....
Iterativefun()
def Iterativefun():
.....
matrix = numpy.delete(matrix, obj,axis)
winner()
Is there a way to delete a row? I thought of changing every single number in that row from 1-10 to a 0 which I’m not using so it would be ignored. Any help will be appreciated
I’m not sure what version of Numpy you have (or exactly what you’re trying to do for that matter), but if you have Numpy 1.7,
numpy.squeezelooks like it might be what you’re looking for… http://docs.scipy.org/doc/numpy/reference/generated/numpy.squeeze.html#numpy.squeeze