title: updating a key value in hdf5 using python and h5py
body: <p>I am having a <code>hdf5</code> file with several keys. I want to update the values of all the keys after doing some adjustment. How to do that?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>hf=h5py.File(fileName,"r+")
  keys=hf.keys()
  for i in keys:
      df=hf[i].value
      df=df-np.mean(df)
  hf.close()
  </code></pre>
  
  <p>But then when I read this file in <code>"r"</code> mode, it shows still the same mean which means it hasn't updated. Any idea where it might be going wrong?</p>
  
  <p>The above issue is fixed in the answer provided. However,
  I am now trying to calibrate the resultant data.
  The code which I am using is:</p>
  
  <pre><code>data = hf[key][...]
  hf[key][...] = data*calibration_factor
  </code></pre>
  
  <p>Just for the simple calibration. However, its resulting to all zeroes in hf[key][...]. Any possible solution for this? I am struggling a lot on this,thanks for understanding.</p>