The functionality I am looking for looks something like this:
data = np.array([[1, 2, 3, 4],
[2, 3, 1],
[5, 5, 5, 5],
[1, 1]])
result = fix(data)
print result
[[ 1. 2. 3. 4.]
[ 2. 3. 1. 0.]
[ 5. 5. 5. 5.]
[ 1. 1. 0. 0.]]
These data arrays I'm working with are really large so I would really appreciate the most efficient solution.
Edit: Data is read in from disk as a python list of lists.