diff --git a/ml2/3_5_Exercise_1.ipynb b/ml2/3_5_Exercise_1.ipynb
index c8db13d..0a9660d 100644
--- a/ml2/3_5_Exercise_1.ipynb
+++ b/ml2/3_5_Exercise_1.ipynb
@@ -46,7 +46,7 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -72,7 +72,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Assign the variable *df* a Dataframe with the Titanic Dataset from the URL https://raw.githubusercontent.com/gsi-upm/sitc/master/ml2/data-titanic/train.csv\"\n",
+ "Assign the variable *df* a Dataframe with the Titanic Dataset from the URL https://raw.githubusercontent.com/gsi-upm/sitc/master/ml2/data-titanic/train.csv.\n",
"\n",
"Print *df*."
]
@@ -209,312 +209,9 @@
},
{
"cell_type": "code",
- "execution_count": 20,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "
\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " PassengerId | \n",
- " Survived | \n",
- " Pclass | \n",
- " Name | \n",
- " Sex | \n",
- " Age | \n",
- " SibSp | \n",
- " Parch | \n",
- " Ticket | \n",
- " Fare | \n",
- " Cabin | \n",
- " Embarked | \n",
- " FamilySize | \n",
- " AgeGroup | \n",
- " Deck | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " 1 | \n",
- " 0 | \n",
- " 3 | \n",
- " Braund, Mr. Owen Harris | \n",
- " male | \n",
- " 22.0 | \n",
- " 1 | \n",
- " 0 | \n",
- " A/5 21171 | \n",
- " 7.2500 | \n",
- " NaN | \n",
- " S | \n",
- " 1 | \n",
- " 3.0 | \n",
- " X | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " 2 | \n",
- " 1 | \n",
- " 1 | \n",
- " Cumings, Mrs. John Bradley (Florence Briggs Th... | \n",
- " female | \n",
- " 38.0 | \n",
- " 1 | \n",
- " 0 | \n",
- " PC 17599 | \n",
- " 71.2833 | \n",
- " C85 | \n",
- " C | \n",
- " 1 | \n",
- " 3.0 | \n",
- " C | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " 3 | \n",
- " 1 | \n",
- " 3 | \n",
- " Heikkinen, Miss. Laina | \n",
- " female | \n",
- " 26.0 | \n",
- " 0 | \n",
- " 0 | \n",
- " STON/O2. 3101282 | \n",
- " 7.9250 | \n",
- " NaN | \n",
- " S | \n",
- " 0 | \n",
- " 3.0 | \n",
- " X | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " 4 | \n",
- " 1 | \n",
- " 1 | \n",
- " Futrelle, Mrs. Jacques Heath (Lily May Peel) | \n",
- " female | \n",
- " 35.0 | \n",
- " 1 | \n",
- " 0 | \n",
- " 113803 | \n",
- " 53.1000 | \n",
- " C123 | \n",
- " S | \n",
- " 1 | \n",
- " 3.0 | \n",
- " C | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " 5 | \n",
- " 0 | \n",
- " 3 | \n",
- " Allen, Mr. William Henry | \n",
- " male | \n",
- " 35.0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 373450 | \n",
- " 8.0500 | \n",
- " NaN | \n",
- " S | \n",
- " 0 | \n",
- " 3.0 | \n",
- " X | \n",
- "
\n",
- " \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- "
\n",
- " \n",
- " 886 | \n",
- " 887 | \n",
- " 0 | \n",
- " 2 | \n",
- " Montvila, Rev. Juozas | \n",
- " male | \n",
- " 27.0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 211536 | \n",
- " 13.0000 | \n",
- " NaN | \n",
- " S | \n",
- " 0 | \n",
- " 3.0 | \n",
- " X | \n",
- "
\n",
- " \n",
- " 887 | \n",
- " 888 | \n",
- " 1 | \n",
- " 1 | \n",
- " Graham, Miss. Margaret Edith | \n",
- " female | \n",
- " 19.0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 112053 | \n",
- " 30.0000 | \n",
- " B42 | \n",
- " S | \n",
- " 0 | \n",
- " 3.0 | \n",
- " B | \n",
- "
\n",
- " \n",
- " 888 | \n",
- " 889 | \n",
- " 0 | \n",
- " 3 | \n",
- " Johnston, Miss. Catherine Helen \"Carrie\" | \n",
- " female | \n",
- " NaN | \n",
- " 1 | \n",
- " 2 | \n",
- " W./C. 6607 | \n",
- " 23.4500 | \n",
- " NaN | \n",
- " S | \n",
- " 3 | \n",
- " NaN | \n",
- " X | \n",
- "
\n",
- " \n",
- " 889 | \n",
- " 890 | \n",
- " 1 | \n",
- " 1 | \n",
- " Behr, Mr. Karl Howell | \n",
- " male | \n",
- " 26.0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 111369 | \n",
- " 30.0000 | \n",
- " C148 | \n",
- " C | \n",
- " 0 | \n",
- " 3.0 | \n",
- " C | \n",
- "
\n",
- " \n",
- " 890 | \n",
- " 891 | \n",
- " 0 | \n",
- " 3 | \n",
- " Dooley, Mr. Patrick | \n",
- " male | \n",
- " 32.0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 370376 | \n",
- " 7.7500 | \n",
- " NaN | \n",
- " Q | \n",
- " 0 | \n",
- " 3.0 | \n",
- " X | \n",
- "
\n",
- " \n",
- "
\n",
- "
891 rows × 15 columns
\n",
- "
"
- ],
- "text/plain": [
- " PassengerId Survived Pclass \\\n",
- "0 1 0 3 \n",
- "1 2 1 1 \n",
- "2 3 1 3 \n",
- "3 4 1 1 \n",
- "4 5 0 3 \n",
- ".. ... ... ... \n",
- "886 887 0 2 \n",
- "887 888 1 1 \n",
- "888 889 0 3 \n",
- "889 890 1 1 \n",
- "890 891 0 3 \n",
- "\n",
- " Name Sex Age SibSp \\\n",
- "0 Braund, Mr. Owen Harris male 22.0 1 \n",
- "1 Cumings, Mrs. John Bradley (Florence Briggs Th... female 38.0 1 \n",
- "2 Heikkinen, Miss. Laina female 26.0 0 \n",
- "3 Futrelle, Mrs. Jacques Heath (Lily May Peel) female 35.0 1 \n",
- "4 Allen, Mr. William Henry male 35.0 0 \n",
- ".. ... ... ... ... \n",
- "886 Montvila, Rev. Juozas male 27.0 0 \n",
- "887 Graham, Miss. Margaret Edith female 19.0 0 \n",
- "888 Johnston, Miss. Catherine Helen \"Carrie\" female NaN 1 \n",
- "889 Behr, Mr. Karl Howell male 26.0 0 \n",
- "890 Dooley, Mr. Patrick male 32.0 0 \n",
- "\n",
- " Parch Ticket Fare Cabin Embarked FamilySize AgeGroup \\\n",
- "0 0 A/5 21171 7.2500 NaN S 1 3.0 \n",
- "1 0 PC 17599 71.2833 C85 C 1 3.0 \n",
- "2 0 STON/O2. 3101282 7.9250 NaN S 0 3.0 \n",
- "3 0 113803 53.1000 C123 S 1 3.0 \n",
- "4 0 373450 8.0500 NaN S 0 3.0 \n",
- ".. ... ... ... ... ... ... ... \n",
- "886 0 211536 13.0000 NaN S 0 3.0 \n",
- "887 0 112053 30.0000 B42 S 0 3.0 \n",
- "888 2 W./C. 6607 23.4500 NaN S 3 NaN \n",
- "889 0 111369 30.0000 C148 C 0 3.0 \n",
- "890 0 370376 7.7500 NaN Q 0 3.0 \n",
- "\n",
- " Deck \n",
- "0 X \n",
- "1 C \n",
- "2 X \n",
- "3 C \n",
- "4 X \n",
- ".. ... \n",
- "886 X \n",
- "887 B \n",
- "888 X \n",
- "889 C \n",
- "890 X \n",
- "\n",
- "[891 rows x 15 columns]"
- ]
- },
- "execution_count": 20,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"df['FamilySize'] = df['SibSp'] + df['Parch']\n",
"df"
@@ -606,23 +303,9 @@
},
{
"cell_type": "code",
- "execution_count": 2,
- "metadata": {
- "collapsed": true
- },
- "outputs": [
- {
- "ename": "NameError",
- "evalue": "name 'df' is not defined",
- "output_type": "error",
- "traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
- "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
- "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Others'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 15\u001b[0;31m \u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Salutation'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Salutation'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mgroup_salutation\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 16\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgroupby\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Salutation'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msize\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;31mNameError\u001b[0m: name 'df' is not defined"
- ]
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"def group_salutation(old_salutation):\n",
" if old_salutation == 'Mr':\n",
@@ -689,7 +372,7 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -712,7 +395,7 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -805,7 +488,7 @@
"window_display": false
},
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -819,7 +502,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.8.8"
+ "version": "3.8.12"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,