Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Python/Module3_IntroducingNumpy/AdvancedIndexing.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,13 @@ The instruction for accessing the contents of `y` in this way is straight-forwar

This returns a *copy* of the data, as do all occurrences of advanced indexing.


<!-- #region -->
```python
# advanced indexing returns a copy
>>> np.shares_memory(y, y[index])
False
```
<!-- #endregion -->

<!-- #region -->
The indexing array can have an arbitrary shape; *the resulting array will match that shape*.
Expand Down
3 changes: 1 addition & 2 deletions Python/Module3_IntroducingNumpy/Broadcasting.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ In effect, NumPy treated `y` as if its contents had been broadcasted along a new

It is important to note that NumPy doesn't really create this broadcasted version of `y` behind the scenes; it is able to do the necessary computations without having to redundantly copy its contents into a shape-(3,4) array. Doing so would be a waste of memory and computation. That being said, this replication process conveys exactly the mathematics of broadcast operations between arrays; thus the preceding diagram reflects how you should always envision broadcasting.

<!-- #endregion -->

Broadcasting is not reserved for operations between 1-D and 2-D arrays, and furthermore both arrays in an operation may undergo broadcasting. That being said, not all pairs of arrays are broadcast-compatible.

Expand Down Expand Up @@ -109,7 +108,7 @@ array([[[ 0, 0],
>>> np.array([1, 2]) * np.array([0, 1, 2])
ValueError: operands could not be broadcast together with shapes (2,) (3,)
```

<!-- #endregion -->

<div class="alert alert-info">

Expand Down
6 changes: 4 additions & 2 deletions Python/Module3_IntroducingNumpy/VectorizedOperations.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ You *can* apply binary NumPy functions to arrays of unlike shapes. For instance,
</div>


<!-- #region -->
```python
# example of a binary function operating on two 2D arrays
>>> x = np.array([[10, 2],
Expand All @@ -338,7 +339,7 @@ array([[11, 2],
>>> x[:, 0] + y[1, :]
array([6, 2])
```

<!-- #endregion -->

<div class="alert alert-info">

Expand Down Expand Up @@ -378,7 +379,7 @@ array([ 1., 4., 9.])
```

This process generalizes to an array of any dimensionality and shape.
<!-- #endregion -->


```python
# examples of a binary function operating on a scalar & an array
Expand All @@ -401,6 +402,7 @@ array([[ 0, -2, -4, -6],
[ -8, -10, -12, -14]])
```

<!-- #endregion -->

<div class="alert alert-info">

Expand Down
3 changes: 2 additions & 1 deletion Python/Module4_OOP/Introduction_to_OOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class Rectangle:
An instance of this `Rectangle` class is an individual rectangle whose *attributes* include its width, height, and center-location. Additionally, we can use the rectangle's *methods* (its attributes that are functions) to compute its area and the locations of its corners.
<!-- #endregion -->

<!-- #region -->
```python
# create a rectangle of width 4, height 10, centered at (0, 0)
# here __init__ is executed and the width/height/center attributes are set
Expand All @@ -124,7 +125,7 @@ Rectangle(width=4, height=10, center=(0, 0))
>>> rect1.compute_corners()
[(2.0, 5.0), (2.0, -5.0), (-2.0, -5.0), (-2.0, 5.0)]
```

<!-- #endregion -->

Just like any other Python object that we have encountered, we can put our `Rectangle`s in lists, store them as values in dictionaries, pass them to functions, reference them with multiple variables, and so on.

Expand Down
3 changes: 2 additions & 1 deletion Python/Module5_OddsAndEnds/WorkingWithFiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ WindowsPath('data/data1.txt')
See that the `/` operator, when used in conjunction with a `Path` instance, created a new path with the appropriate path-separator for the present OS. This is extremely convenient!

Let's proceed to explore some other useful methods that `Path` provides us with. These methods enable us to inspect directories and files, create new directories, list all of the files in a directory, open files to for reading/writing, and much more. A complete listing of these methods can be found [here](https://docs.python.org/3/library/pathlib.html#methods-and-properties) and [here](https://docs.python.org/3/library/pathlib.html#methods), collectively; it is highly recommended that you take time to look through them.
<!-- #endregion -->


```python
>>> root = Path(".")
Expand Down Expand Up @@ -99,6 +99,7 @@ WindowsPath('C:/Users/TerranceWasabi/Desktop/PLYMI/Module5_OddsAndEnds/data/data
'data\\data1.txt'
```

<!-- #endregion -->

<div class="alert alert-info">

Expand Down
2 changes: 1 addition & 1 deletion Python/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
'.md': lambda s: jupytext.reads(s, '.md'),
}

nbsphinx_allow_errors = True
nbsphinx_allow_errors = False

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down