|
481 | 481 | "students_gpas"
|
482 | 482 | ]
|
483 | 483 | },
|
| 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 | + }, |
484 | 503 | {
|
485 | 504 | "cell_type": "code",
|
486 | 505 | "execution_count": 86,
|
|
1084 | 1103 | "study_minutes[2]"
|
1085 | 1104 | ]
|
1086 | 1105 | },
|
| 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 | + }, |
1087 | 1115 | {
|
1088 | 1116 | "cell_type": "code",
|
1089 | | - "execution_count": 91, |
| 1117 | + "execution_count": null, |
1090 | 1118 | "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": [], |
1103 | 1127 | "source": [
|
1104 | 1128 | "np.add.reduce(study_minutes[0])"
|
1105 | 1129 | ]
|
|
0 commit comments