Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 95d1513

Browse files
author
craigsdennis
committed
Adds common routine notes and notes on reduction and accumulation
1 parent d241a74 commit 95d1513

File tree

1 file changed

+37
-13
lines changed

1 file changed

+37
-13
lines changed

‎Introduction to NumPy.ipynb

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,25 @@
481481
"students_gpas"
482482
]
483483
},
484+
{
485+
"cell_type": "markdown",
486+
"metadata": {},
487+
"source": [
488+
"## Common Routines\n",
489+
"* Common [mathematical](https://docs.scipy.org/doc/numpy-1.14.0/reference/routines.math.html) [routines](https://docs.scipy.org/doc/numpy-1.14.0/reference/routines.html) are exposed so the formula can be abstracted away.\n",
490+
" * [`mean`](https://docs.scipy.org/doc/numpy-1.14.0/reference/generated/numpy.mean.html#numpy.mean) is a routine [statistics](https://docs.scipy.org/doc/numpy-1.14.0/reference/routines.statistics.html) used to calculate the average.\n",
491+
"* Reduction functions take a dimension and collapse it into a single value.\n",
492+
" * These functions define an axis parameter, and you should remember that the function works across the dimension.\n",
493+
" "
494+
]
495+
},
496+
{
497+
"cell_type": "code",
498+
"execution_count": null,
499+
"metadata": {},
500+
"outputs": [],
501+
"source": []
502+
},
484503
{
485504
"cell_type": "code",
486505
"execution_count": 86,
@@ -1084,22 +1103,27 @@
10841103
"study_minutes[2]"
10851104
]
10861105
},
1106+
{
1107+
"cell_type": "markdown",
1108+
"metadata": {},
1109+
"source": [
1110+
"## Universal Functions - Reduce / Accumulate\n",
1111+
"* Universal Functions expose a function to [`reduce`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.ufunc.reduce.html) an array to a single value.\n",
1112+
"* There is also a function named [`accumulate`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.ufunc.accumulate.html) which will show the reduction and it's accumulation as it happens."
1113+
]
1114+
},
10871115
{
10881116
"cell_type": "code",
1089-
"execution_count": 91,
1117+
"execution_count": null,
10901118
"metadata": {},
1091-
"outputs": [
1092-
{
1093-
"data": {
1094-
"text/plain": [
1095-
"440"
1096-
]
1097-
},
1098-
"execution_count": 91,
1099-
"metadata": {},
1100-
"output_type": "execute_result"
1101-
}
1102-
],
1119+
"outputs": [],
1120+
"source": []
1121+
},
1122+
{
1123+
"cell_type": "code",
1124+
"execution_count": null,
1125+
"metadata": {},
1126+
"outputs": [],
11031127
"source": [
11041128
"np.add.reduce(study_minutes[0])"
11051129
]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /