how to compare arrays above and below python : i'm new to python and am looking  for a way to compare the above and below arrays so I can have a computer make a decision based upon them, and then update the array. I am open to different methods if this is a bad way to go about this.


   import numpy as np
   import matplotlib.pylab as plt

    	return 1/(1+np.exp(-x))
        #the array
    X = np.array([[5,5,5,5,5,5,5,5,5,5,5,5],
                [5,4,1,0,1,1,1,0,1,1,1,5],
                [5,0,1,0,1,0,1,0,1,0,1,5],
                [5,0,1,0,1,0,1,0,1,0,1,5],
                [5,0,1,0,1,0,1,0,1,0,1,5],
                [5,0,1,0,1,0,1,0,1,0,1,5],
                [5,0,1,2,1,2,1,2,1,2,1,5],
                [5,0,1,0,1,0,1,0,1,0,1,5],
                [5,0,1,0,1,0,1,0,1,0,1,5],
                [5,0,1,0,1,0,1,0,1,0,1,5],
                [5,0,1,0,1,0,1,0,1,0,3,5],
                [5,5,5,5,5,5,5,5,5,5,5,5]])
    
    print(X)

This outputs 

    [[5 5 5 5 5 5 5 5 5 5 5 5]
     [5 4 1 0 1 1 1 0 1 1 1 5]
     [5 0 1 0 1 0 1 0 1 0 1 5]
     [5 0 1 0 1 0 1 0 1 0 1 5]
     [5 0 1 0 1 0 1 0 1 0 1 5]
     [5 0 1 0 1 0 1 0 1 0 1 5]
     [5 0 1 2 1 2 1 2 1 2 1 5]
     [5 0 1 0 1 0 1 0 1 0 1 5]
     [5 0 1 0 1 0 1 0 1 0 1 5]
     [5 0 1 0 1 0 1 0 1 0 1 5]
     [5 0 1 0 1 0 1 0 1 0 3 5]
     [5 5 5 5 5 5 5 5 5 5 5 5]]

As an example, comparing the 4 to the above 5 and below 0 so it can make a decision based upon the neighboring numbers. I also need to compare the ones to the left and right, so re formatting the array 90 degrees wouldn't work.