diff --git a/README.html b/README.html index aafa6dc..db75cad 100644 --- a/README.html +++ b/README.html @@ -28,8 +28,6 @@ is:

Here is what the page looks like so far: http://www.labri.fr/perso/nrougier/teaching/numpy.100/index.html

Repository is at: https://github.com/rougier/numpy-100

-

The corresponding IPython notebook is available -from the github repo, thanks to the rst2ipynb conversion tool by Valentin Haenel

Thanks to Michiaki Ariga, there is now a Julia version.

    @@ -246,6 +244,19 @@ point by point distances

    print G +
  1. Subtract the mean of each row of a matrix

    +
    +# Author: Warren Weckesser
    +
    +X = np.random.rand(5, 10)
    +
    +# Recent versions of numpy
    +Y = X - X.mean(axis=1, keepdims=True)
    +
    +# Older versions of numpy
    +Y = X - X.mean(axis=1).reshape(-1, 1)
    +
    +
  2. How to tell if a given 2D array has null columns ?

     # Author: Warren Weckesser
    diff --git a/README.rst b/README.rst
    index 11d43ac..fdb1144 100644
    --- a/README.rst
    +++ b/README.rst
    @@ -293,6 +293,21 @@ Thanks to Michiaki Ariga, there is now a
           G = np.exp(-( (D-mu)**2 / ( 2.0 * sigma**2 ) ) )
           print G
     
    +#. Subtract the mean of each row of a matrix
    +
    +   .. code-block:: python
    +
    +      # Author: Warren Weckesser
    +
    +      X = np.random.rand(5, 10)
    +
    +      # Recent versions of numpy
    +      Y = X - X.mean(axis=1, keepdims=True)
    +
    +      # Older versions of numpy
    +      Y = X - X.mean(axis=1).reshape(-1, 1)
    +
    +   
     
     #. How to tell if a given 2D array has null columns ?