Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish the NumPy content #240

Merged
merged 6 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,4 @@ content/notebooks_gallery/

# Notebook outputs
core/pandas/nino_analyzed_output.csv
core/matplotlib/animate.gif
6 changes: 2 additions & 4 deletions core/numpy.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# NumPy
<img src=https://github.com/numpy/numpy/raw/main/branding/logo/primary/numpylogo.svg width=250 alt="NumPy Logo"></img>

```{note}
This content is under construction!
```
# NumPy

This section contains tutorials on array computing with [NumPy](https://numpy.org).

Expand Down
4 changes: 2 additions & 2 deletions core/numpy/intermediate-numpy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"metadata": {},
"source": [
"## Imports\n",
"We will be including [matplotlib](../matplotlib) to illustrate some of our examples, but you don't need knowledge of it to complete this notebook."
"We will be including [Matplotlib](../matplotlib) to illustrate some of our examples, but you don't need knowledge of it to complete this notebook."
]
},
{
Expand Down Expand Up @@ -668,7 +668,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.8.12"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion core/numpy/numpy-basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.8.12"
},
"toc-autonumbering": false
},
Expand Down
10 changes: 5 additions & 5 deletions core/numpy/numpy-broadcasting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"metadata": {},
"source": [
"## Overview\n",
"Before we begin, broadcasting is a valuable part of the power that NumPy provides. However, there's no looking past the fact that broadcasting can be conceptually difficult to digest. This information can be helpful and very powerful, but we also suggest moving on to take a look at some of the label-based corners of the Python ecosystem, namely [pandas](../pandas) and [xarray](../xarray) for the ways that they make some of these concepts simpler or easier to use for real-world data.\n",
"Before we begin, broadcasting is a valuable part of the power that NumPy provides. However, there's no looking past the fact that broadcasting can be conceptually difficult to digest. This information can be helpful and very powerful, but we also suggest moving on to take a look at some of the label-based corners of the Python ecosystem, namely [Pandas](../pandas) and [Xarray](../xarray) for the ways that they make some of these concepts simpler or easier to use for real-world data.\n",
"\n",
"1. An introduction to broadcasting\n",
"1. Avoiding loops with vectorization"
Expand Down Expand Up @@ -655,7 +655,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Another option to solve this is not using slicing but by using a powerful numpy tool: `as_strided`. This tool can result in some odd behavior, so take care when using--the trade-off is that this can be used to do some powerful operations. What we're doing here is altering how NumPy is interpreting the values in the memory that underpins the array. So for this array:"
"Another option to solve this is not using slicing but by using a powerful NumPy tool: `as_strided`. This tool can result in some odd behavior, so take care when using--the trade-off is that this can be used to do some powerful operations. What we're doing here is altering how NumPy is interpreting the values in the memory that underpins the array. So for this array:"
]
},
{
Expand All @@ -671,7 +671,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"we can create a view of the array with a new, bigger shape, with rows made up of overlapping values. We do this by specifying a new shape of 8x3, one row for each of the length 3 blocks we can fit in the original 1-D array of data. We then use the `strides` argument to control how numpy walks between items in each dimension. The last item in the strides tuple is just as normal--it says that the number of bytes to walk between items is just the size of an item. (Increasing this would skip items.) The first item says that when we go to a new, in this case row, only advance the size of a single item. This is what gives us overlapping rows."
"we can create a view of the array with a new, bigger shape, with rows made up of overlapping values. We do this by specifying a new shape of 8x3, one row for each of the length 3 blocks we can fit in the original 1-D array of data. We then use the `strides` argument to control how NumPy walks between items in each dimension. The last item in the strides tuple is just as normal--it says that the number of bytes to walk between items is just the size of an item. (Increasing this would skip items.) The first item says that when we go to a new, in this case row, only advance the size of a single item. This is what gives us overlapping rows."
]
},
{
Expand Down Expand Up @@ -900,7 +900,7 @@
"We've previewed some advanced NumPy capabilities with a focus on _vectorization_, or using clever broadcasting and windows of our data to enhance the speed and readability of our calculations. Doing so can reduce explicit construction of loops in your code and keep calculations running quickly!\n",
"\n",
"### What's next\n",
"This is an advanced NumPy topic, and important to designing your own calculations in a way for them to be as scalable and quick as possible. Please check out some of the following links to explore this topic further. We also suggest diving into label-based indexing and subsetting with [pandas](../pandas) and [xarray](../xarray), where some of this broadcasting can be simplified or have added context."
"This is an advanced NumPy topic, and important to designing your own calculations in a way for them to be as scalable and quick as possible. Please check out some of the following links to explore this topic further. We also suggest diving into label-based indexing and subsetting with [Pandas](../pandas) and [Xarray](../xarray), where some of this broadcasting can be simplified or have added context."
]
},
{
Expand Down Expand Up @@ -929,7 +929,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.8.12"
}
},
"nbformat": 4,
Expand Down