diff --git a/ml2/3_5_Exercise_1.ipynb b/ml2/3_5_Exercise_1.ipynb
index c59fba3..80dcc56 100644
--- a/ml2/3_5_Exercise_1.ipynb
+++ b/ml2/3_5_Exercise_1.ipynb
@@ -81,147 +81,12 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": null,
"metadata": {
"collapsed": false
},
- "outputs": [
- {
- "data": {
- "text/html": [
- "
\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",
- "
\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",
- "
\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",
- "
\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",
- "
\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",
- "
\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",
- "
\n",
- " \n",
- "
\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",
- " 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",
- " Parch Ticket Fare Cabin Embarked \n",
- "0 0 A/5 21171 7.2500 NaN S \n",
- "1 0 PC 17599 71.2833 C85 C \n",
- "2 0 STON/O2. 3101282 7.9250 NaN S \n",
- "3 0 113803 53.1000 C123 S \n",
- "4 0 373450 8.0500 NaN S "
- ]
- },
- "execution_count": 3,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "url=\"https://raw.githubusercontent.com/gsi-upm/sitc/master/ml2/data-titanic/train.csv\"\n",
- "df = pd.read_csv(url)\n",
- "df_original = df.copy() # Copy to have a version of df without modifications\n",
- "df.head()"
- ]
+ "outputs": [],
+ "source": []
},
{
"cell_type": "markdown",
@@ -572,83 +437,11 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 8,
"metadata": {
"collapsed": false
},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "0 X\n",
- "1 A\n",
- "2 X\n",
- "3 A\n",
- "4 X\n",
- "5 X\n",
- "6 A\n",
- "7 X\n",
- "8 X\n",
- "9 X\n",
- "10 A\n",
- "11 A\n",
- "12 X\n",
- "13 X\n",
- "14 X\n",
- "15 X\n",
- "16 X\n",
- "17 X\n",
- "18 X\n",
- "19 X\n",
- "20 X\n",
- "21 A\n",
- "22 X\n",
- "23 A\n",
- "24 X\n",
- "25 X\n",
- "26 X\n",
- "27 A\n",
- "28 X\n",
- "29 X\n",
- " ..\n",
- "861 X\n",
- "862 A\n",
- "863 X\n",
- "864 X\n",
- "865 X\n",
- "866 X\n",
- "867 A\n",
- "868 X\n",
- "869 X\n",
- "870 X\n",
- "871 A\n",
- "872 A\n",
- "873 X\n",
- "874 X\n",
- "875 X\n",
- "876 X\n",
- "877 X\n",
- "878 X\n",
- "879 A\n",
- "880 X\n",
- "881 X\n",
- "882 X\n",
- "883 X\n",
- "884 X\n",
- "885 X\n",
- "886 X\n",
- "887 A\n",
- "888 X\n",
- "889 A\n",
- "890 X\n",
- "Name: Deck, dtype: object"
- ]
- },
- "execution_count": 7,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"def substrings_in_string(big_string, substrings):\n",
" if type(big_string) == float:\n",
@@ -662,8 +455,7 @@
" \n",
"#Turning cabin number into Deck\n",
"cabin_list = ['A', 'B', 'C', 'D', 'E', 'F', 'T', 'G', 'Unknown']\n",
- "df['Deck']=df['Cabin'].map(lambda x: substrings_in_string(x, cabin_list))\n",
- "df['Deck']\n"
+ "df['Deck']=df['Cabin'].map(lambda x: substrings_in_string(x, cabin_list))"
]
},
{