diff --git a/exercises/Numpy_KMeansClustering/NumPy_KMeansClustering.ipynb b/exercises/Numpy_KMeansClustering/NumPy_KMeansClustering.ipynb index 636b74b0a37eba8272bbc6986d9ae5a6480938df..2aff39d640b00ea160f6ca7788b769edd71d6c9c 100644 --- a/exercises/Numpy_KMeansClustering/NumPy_KMeansClustering.ipynb +++ b/exercises/Numpy_KMeansClustering/NumPy_KMeansClustering.ipynb @@ -227,7 +227,7 @@ " # Test for convergence\n", " ### --> you provide this solution ###\n", " if centers_have_not_changed(coords_center, coords_center_old):\n", - " if visualize_progres:\n", + " if visualize_progress:\n", " # visualize final state\n", " sleep(sleep_time)\n", " clear_output(wait=True)\n", @@ -257,7 +257,7 @@ " #initial_random_state=int(time()),# initial random seed - use a fixed value, if you want to have the same initial state for every execution\n", " # this is a good random seed to see the bug\n", " initial_random_state=4321,\n", - " visualize_progres=True,#Turn Off, if you do not want to wait for the visualization\n", + " visualize_progress=True,#Turn Off, if you do not want to wait for the visualization\n", " sleep_time=1 # the sleep time controls the speed of the visualization (lower means faster)\n", " \n", " )\n", @@ -297,7 +297,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, diff --git a/exercises/Numpy_KMeansClustering/NumPy_KMeansClustering_stdPython.ipynb b/exercises/Numpy_KMeansClustering/NumPy_KMeansClustering_stdPython.ipynb index 456c8feea6da474385194ae85091e62f0879b307..0108bed2b90f1c7ad1c173c325b4534f40b14234 100644 --- a/exercises/Numpy_KMeansClustering/NumPy_KMeansClustering_stdPython.ipynb +++ b/exercises/Numpy_KMeansClustering/NumPy_KMeansClustering_stdPython.ipynb @@ -247,7 +247,7 @@ " # Test for convergence\n", " ### --> you provide this solution ###\n", " if centers_have_not_changed(coords_center, coords_center_old):\n", - " if visualize_progres:\n", + " if visualize_progress:\n", " # visualize final state\n", " sleep(sleep_time)\n", " clear_output(wait=True)\n", @@ -275,7 +275,7 @@ " n_centers=n_clusters,# number of clusters\n", " n_iter=n_iter,# maximum number of iterations to perform, if algorithm does not converge before\n", " initial_random_state=int(time()),# initial random seed - use a fixed value, if you want to have the same initial state for every execution\n", - " visualize_progres=True,#Turn Off, if you do not want to wait for the visualization\n", + " visualize_progress=True,#Turn Off, if you do not want to wait for the visualization\n", " sleep_time=0.5 # the sleep time controls the speed of the visualization (lower means faster)\n", " \n", " )\n", diff --git a/exercises/Numpy_KMeansClustering/NumPy_KMeansClustering_tasks.ipynb b/exercises/Numpy_KMeansClustering/NumPy_KMeansClustering_tasks.ipynb index 40f98b5b7de4f2afa664b8a62ab49e9792cbe4db..04812cbcf8aeb364b0a45a92d9491b8e188fe4a4 100644 --- a/exercises/Numpy_KMeansClustering/NumPy_KMeansClustering_tasks.ipynb +++ b/exercises/Numpy_KMeansClustering/NumPy_KMeansClustering_tasks.ipynb @@ -230,7 +230,7 @@ " # Test for convergence\n", " ### --> you provide this function ###\n", " if centers_have_not_changed(coords_center, coords_center_old):\n", - " if visualize_progres:\n", + " if visualize_progress:\n", " # visualize final state\n", " sleep(sleep_time)\n", " clear_output(wait=True)\n", @@ -259,7 +259,7 @@ " #initial_random_state=int(time()),# initial random seed - use a fixed value, if you want to have the same initial state for every execution\n", " # this is a good random seed to see the bug\n", " initial_random_state=4321,\n", - " visualize_progres=True,#Turn Off, if you do not want to wait for the visualization\n", + " visualize_progress=True,#Turn Off, if you do not want to wait for the visualization\n", " sleep_time=0.5 # the sleep time controls the speed of the visualization (lower means faster)\n", " \n", " )\n", @@ -283,7 +283,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, diff --git a/slides/Day2_PandasDataFrames.ipynb b/slides/Day2_PandasDataFrames.ipynb index 288ef4f76211849868b2ac8055e7f3dfe237e890..38a5542c2c4bde2b18ecd6390dbaf26e9f5da85c 100644 --- a/slides/Day2_PandasDataFrames.ipynb +++ b/slides/Day2_PandasDataFrames.ipynb @@ -2213,7 +2213,11 @@ "id": "53d45569", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "cols=[\"sepal length\",\"sepal width\",\"petal length\",\"petal width\"]\n", + "df_agg= df.loc[:,cols].agg([np.min, np.max, np.mean, np.std])\n", + "df_agg" + ] }, { "cell_type": "markdown", @@ -2229,7 +2233,10 @@ "id": "52a96d54", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "df.loc[:,cols] =((df.loc[:,cols] - df_agg.loc['mean',:] )/ df_agg.loc['std',:])\n", + "df.describe()" + ] }, { "cell_type": "markdown", @@ -2263,7 +2270,9 @@ "id": "801dd946", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "grouped_by_species = df.groupby(by=[\"Name\"])" + ] }, { "cell_type": "code", @@ -2271,7 +2280,12 @@ "id": "90b8c49e", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "fig, axs = plt.subplots(1,3)\n", + "for ax, (name, group_data) in zip(axs,grouped_by_species): \n", + " group_data.boxplot(ax=ax)\n", + " ax.set_title(name)" + ] }, { "cell_type": "code", @@ -2285,7 +2299,7 @@ "metadata": { "celltoolbar": "Slideshow", "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" },