test = np.array([None])
k = k[k!=test].reshape(-1, 2).astype(float)
And then sum up the columns and make the plot. The problem of your approach is that you did not convert the None type to a numpy array, which did not allow the proper creation of the mask.