typo
This commit is contained in:
16
README.rst
16
README.rst
@@ -834,17 +834,17 @@ Thanks to Michiaki Ariga, there is now a
|
|||||||
|
|
||||||
#. How to get the n largest values of an array (★★★)
|
#. How to get the n largest values of an array (★★★)
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
Z = np.arange(10000)
|
Z = np.arange(10000)
|
||||||
np.random.shuffle(Z)
|
np.random.shuffle(Z)
|
||||||
n = 5
|
n = 5
|
||||||
|
|
||||||
# Slow
|
# Slow
|
||||||
print (Z[np.argsort(Z)[-n:]])
|
print (Z[np.argsort(Z)[-n:]])
|
||||||
|
|
||||||
# Fast
|
# Fast
|
||||||
print (Z[np.argpartition(-Z,n)[:n]])
|
print (Z[np.argpartition(-Z,n)[:n]])
|
||||||
|
|
||||||
|
|
||||||
#. Given an arbitrary number of vectors, build the cartesian product (every
|
#. Given an arbitrary number of vectors, build the cartesian product (every
|
||||||
|
|||||||
Reference in New Issue
Block a user