title: Z-score normalization in pandas DataFrame (python)
body: <p>I am using python3 (spyder), and I have a table which is the type of object "pandas.core.frame.DataFrame". I want to z-score normalize the values in that table (to each value substract the mean of its row and divide by the sd of its row), so each row has mean=0 and sd=1. I have tried 2 approaches. </p>
  
  <p>First approach</p>
  
  <pre><code>from scipy.stats import zscore
  zetascore_table=zscore(table,axis=1)
  </code></pre>
  
  <p>Second approach</p>
  
  <pre><code>rows=table.index.values
  columns=table.columns
  import numpy as np
  for i in range(len(rows)):
      for j in range(len(columns)):
           table.loc[rows[i],columns[j]]=(table.loc[rows[i],columns[j]] - np.mean(table.loc[rows[i],]))/np.std(table.loc[rows[i],])
  table
  </code></pre>
  
  <p>Both approaches seem to work, but when I check the mean and sd of each row it is not 0 and 1 as it is suppose to be, but other float values. I don´t know which can be the problem.</p>
  
  <p>Thanks in advance for your help!</p>