Skip to content

Commit 0bc6a7e

Browse files
committed
Modify example code for quick nan removal
1 parent e2b63d7 commit 0bc6a7e

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

core/numpy/numpy-intermediate.ipynb

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@
111111
"cell_type": "code",
112112
"execution_count": null,
113113
"metadata": {
114-
"scrolled": true
114+
"scrolled": true,
115+
"tags": []
115116
},
116117
"outputs": [],
117118
"source": [
@@ -302,8 +303,9 @@
302303
"\n",
303304
"# BONUS POINTS: Plot only the data where heat index is defined by\n",
304305
"# inverting the mask (using ~mask) and setting invalid values to np.nan\n",
305-
"temp[~good_heat_index] = np.nan\n",
306-
"plt.plot(temp, 'tab:red')"
306+
"plot_temp = temp.copy()\n",
307+
"plot_temp[~good_heat_index] = np.nan\n",
308+
"plt.plot(plot_temp, 'tab:red')"
307309
]
308310
},
309311
{
@@ -403,16 +405,7 @@
403405
"cell_type": "markdown",
404406
"metadata": {},
405407
"source": [
406-
"There are other numpy arg functions that return indices for operating:"
407-
]
408-
},
409-
{
410-
"cell_type": "code",
411-
"execution_count": null,
412-
"metadata": {},
413-
"outputs": [],
414-
"source": [
415-
"np.*arg*?"
408+
"There are other numpy arg functions that return indices for operating; check out the [NumPy docs](https://numpy.org/doc/stable/reference/routines.sort.html) on sorting your arrays!"
416409
]
417410
},
418411
{

0 commit comments

Comments
 (0)