I wanna standardize my input data for a neural network.
Data looks like this:
data= np.array([[0,0,0,0,233,2,0,0,0],[0,0,0,23,50,2,0,0,0],[0,0,0,0,3,20,3,0,0]])
This is the function that I used. It doesn't work because of the zeros.
def standardize(data): #dataframe
_,c = data.shape
data_standardized = data.copy(deep=True)
for j in range(c):
x = data_standardized.iloc[:, j]
avg = x.mean()
std = x.std()
x_standardized = (x - avg)/ std
data_standardized.iloc[:, j] = x_standardized
return data_standardized