From 179c62773fd249618831e8f88f065816297ceb93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Tue, 29 Jan 2019 16:37:41 +0100 Subject: [PATCH] Numpy --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 28a3836..3f41a8a 100644 --- a/README.md +++ b/README.md @@ -1693,6 +1693,7 @@ NumPy import numpy as np ``` +**Shape is a tuple of ints, representing sizes of array's dimensions.** ```python = np.array() = np.arange(from_inclusive, to_exclusive, step_size) @@ -1713,12 +1714,12 @@ import numpy as np ### Indexing #### Basic indexing -```python +```bash = <2d_array>[0, 0] ``` #### Basic slicing -```python +```bash <1d_view> = <2d_array>[0] # First row. <1d_view> = <2d_array>[:, 0] # First column. Also [..., 0]. <3d_view> = <2d_array>[None,:,:] # Expanded by dimension of size 1. @@ -1726,13 +1727,13 @@ import numpy as np #### Integer array indexing **If row and column indexes differ in shape, they are combined with broadcasting.** -```python +```bash <1d_array> = <2d_array>[<1d_row_indexes>, <1d_column_indexes>] <2d_array> = <2d_array>[<2d_row_indexes>, <2d_column_indexes>] ``` #### Boolean array indexing -```python +```bash <2d_bool_array> = <2d_array> > 0 <1d_array> = <2d_array>[<2d_bool_array>] ```