Fix some mis-alignment in code blocks
This commit is contained in:
35
README.rst
35
README.rst
@@ -104,10 +104,10 @@ Thanks to Michiaki Ariga, there is now a
|
|||||||
|
|
||||||
#. Create a 3x3x3 array with random values
|
#. Create a 3x3x3 array with random values
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
Z = np.random.random((3,3,3))
|
Z = np.random.random((3,3,3))
|
||||||
print Z
|
print Z
|
||||||
|
|
||||||
#. Create a 8x8 matrix and fill it with a checkerboard pattern
|
#. Create a 8x8 matrix and fill it with a checkerboard pattern
|
||||||
|
|
||||||
@@ -192,11 +192,11 @@ Thanks to Michiaki Ariga, there is now a
|
|||||||
|
|
||||||
#. Create a random vector of size 30 and find the mean value
|
#. Create a random vector of size 30 and find the mean value
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
Z = np.random.random(30)
|
Z = np.random.random(30)
|
||||||
m = Z.mean()
|
m = Z.mean()
|
||||||
print m
|
print m
|
||||||
|
|
||||||
|
|
||||||
#. Make an array immutable (read-only)
|
#. Make an array immutable (read-only)
|
||||||
@@ -320,12 +320,12 @@ Thanks to Michiaki Ariga, there is now a
|
|||||||
|
|
||||||
#. Find the nearest value from a given value in an array
|
#. Find the nearest value from a given value in an array
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
Z = np.random.uniform(0,1,10)
|
Z = np.random.uniform(0,1,10)
|
||||||
z = 0.5
|
z = 0.5
|
||||||
m = Z.flat[np.abs(Z - z).argmin()]
|
m = Z.flat[np.abs(Z - z).argmin()]
|
||||||
print m
|
print m
|
||||||
|
|
||||||
|
|
||||||
#. Consider the following file::
|
#. Consider the following file::
|
||||||
@@ -405,7 +405,6 @@ Thanks to Michiaki Ariga, there is now a
|
|||||||
#. Considering a one-dimensional vector D, how to compute means of subsets of D
|
#. Considering a one-dimensional vector D, how to compute means of subsets of D
|
||||||
using a vector S of same size describing subset indices ?
|
using a vector S of same size describing subset indices ?
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
# Author: Jaime Fernández del Río
|
# Author: Jaime Fernández del Río
|
||||||
@@ -462,13 +461,13 @@ Thanks to Michiaki Ariga, there is now a
|
|||||||
#. How to swap two rows of an array ?
|
#. How to swap two rows of an array ?
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
# Author: Eelco Hoogendoorn
|
# Author: Eelco Hoogendoorn
|
||||||
|
|
||||||
A = np.arange(25).reshape(5,5)
|
A = np.arange(25).reshape(5,5)
|
||||||
A[[0,1]] = A[[1,0]]
|
A[[0,1]] = A[[1,0]]
|
||||||
print A
|
print A
|
||||||
|
|
||||||
|
|
||||||
#. Consider a one-dimensional array Z, build a two-dimensional array whose
|
#. Consider a one-dimensional array Z, build a two-dimensional array whose
|
||||||
|
|||||||
Reference in New Issue
Block a user