{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"> Importing Necessary Libraries","metadata":{}},{"cell_type":"code","source":"import numpy as np \nimport pandas as pd\nimport missingno as msno\nimport tensorflow as tf\nimport keras\nfrom keras import Input, Model\nfrom keras.layers import StringLookup, IntegerLookup, CategoryEncoding, Normalization, Dense, Dropout, concatenate\n\nimport matplotlib.pyplot as plt","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-08-02T09:04:27.871881Z","iopub.execute_input":"2022-08-02T09:04:27.872296Z","iopub.status.idle":"2022-08-02T09:04:27.879044Z","shell.execute_reply.started":"2022-08-02T09:04:27.872264Z","shell.execute_reply":"2022-08-02T09:04:27.877658Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> Load the dataset","metadata":{}},{"cell_type":"code","source":"X = pd.read_csv('../input/spaceship-titanic/train.csv')\ny = pd.read_csv('../input/spaceship-titanic/test.csv')","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:28.288806Z","iopub.execute_input":"2022-08-02T09:04:28.289951Z","iopub.status.idle":"2022-08-02T09:04:28.334209Z","shell.execute_reply.started":"2022-08-02T09:04:28.289908Z","shell.execute_reply":"2022-08-02T09:04:28.333124Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(X.shape, y.shape)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:28.842318Z","iopub.execute_input":"2022-08-02T09:04:28.843322Z","iopub.status.idle":"2022-08-02T09:04:28.848543Z","shell.execute_reply.started":"2022-08-02T09:04:28.843279Z","shell.execute_reply":"2022-08-02T09:04:28.847625Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:29.489993Z","iopub.execute_input":"2022-08-02T09:04:29.490682Z","iopub.status.idle":"2022-08-02T09:04:29.510833Z","shell.execute_reply.started":"2022-08-02T09:04:29.490646Z","shell.execute_reply":"2022-08-02T09:04:29.509430Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X.describe()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:30.037243Z","iopub.execute_input":"2022-08-02T09:04:30.038077Z","iopub.status.idle":"2022-08-02T09:04:30.073645Z","shell.execute_reply.started":"2022-08-02T09:04:30.038029Z","shell.execute_reply":"2022-08-02T09:04:30.072479Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X.info()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:30.584322Z","iopub.execute_input":"2022-08-02T09:04:30.585152Z","iopub.status.idle":"2022-08-02T09:04:30.604308Z","shell.execute_reply.started":"2022-08-02T09:04:30.585103Z","shell.execute_reply":"2022-08-02T09:04:30.603233Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def num_cat(data):\n    '''A function to select categorical and numerical columns data types '''\n    \n    categorical_columns = data.select_dtypes(exclude='number').columns\n    numerical_columns = data.select_dtypes(include='number').columns\n    \n    \n    return numerical_columns, categorical_columns\n\ndef missing_values_percentage(data, columns):\n    \n    '''A function to show missingvalues of the dataframe'''\n    \n    for column in data[columns]:\n        missing_percentage = round(X[column].isnull().mean() * 100)\n        if not missing_percentage == 0:\n            print('{} - {}%'.format(column, missing_percentage))\n\n        else: \n            print('{} - No missing value'.format(column))\n           ","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:31.139174Z","iopub.execute_input":"2022-08-02T09:04:31.139890Z","iopub.status.idle":"2022-08-02T09:04:31.148000Z","shell.execute_reply.started":"2022-08-02T09:04:31.139839Z","shell.execute_reply":"2022-08-02T09:04:31.147149Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def single_imputation(data, columns, numeric=False):\n    \n    '''A function to fill in missing data using single imputation method'''\n    \n    if numeric:      \n        for column in columns:\n            if column == 'Age':\n                data[column].fillna(data[column].median(), axis=0, inplace=True)\n\n            else:\n                data[column].fillna(data[column].mean(), axis=0, inplace=True)\n\n    else:\n        for column in columns:\n            data[column].fillna(data[column].mode()[0], axis=0, inplace=True)\n\ndef preprocess_values(data):\n    \n    '''A function to replace boolean values into binary'''\n    for column in data.columns:\n        if data[column].dtype == bool:\n            data[column] = np.where(data[column] == False, 0, 1)\n        ","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:31.783762Z","iopub.execute_input":"2022-08-02T09:04:31.784378Z","iopub.status.idle":"2022-08-02T09:04:31.791484Z","shell.execute_reply.started":"2022-08-02T09:04:31.784336Z","shell.execute_reply":"2022-08-02T09:04:31.790640Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> Check dataframe values missingness","metadata":{}},{"cell_type":"code","source":"numerical_columns, categorical_columns = num_cat(X)\nprint('Categorical columns', '\\n')\nmissing_values_percentage(X, categorical_columns)\nprint('\\n')\nprint('Numerical columns', '\\n')\nmissing_values_percentage(X, numerical_columns)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:32.337149Z","iopub.execute_input":"2022-08-02T09:04:32.337925Z","iopub.status.idle":"2022-08-02T09:04:32.358763Z","shell.execute_reply.started":"2022-08-02T09:04:32.337871Z","shell.execute_reply":"2022-08-02T09:04:32.357561Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"msno.bar(X, figsize=(18,4), fontsize=12)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:32.727825Z","iopub.execute_input":"2022-08-02T09:04:32.728685Z","iopub.status.idle":"2022-08-02T09:04:33.552603Z","shell.execute_reply.started":"2022-08-02T09:04:32.728646Z","shell.execute_reply":"2022-08-02T09:04:33.551342Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"single_imputation(X, categorical_columns)\nsingle_imputation(X, numerical_columns, numeric=True)\n\npreprocess_values(X)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:33.554719Z","iopub.execute_input":"2022-08-02T09:04:33.555816Z","iopub.status.idle":"2022-08-02T09:04:33.595911Z","shell.execute_reply.started":"2022-08-02T09:04:33.555766Z","shell.execute_reply":"2022-08-02T09:04:33.594647Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> Split the dataframe","metadata":{}},{"cell_type":"code","source":"train, val= np.split(X.sample(frac=1, random_state=32), indices_or_sections=[int(len(X) * 0.8)])","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:33.636664Z","iopub.execute_input":"2022-08-02T09:04:33.637103Z","iopub.status.idle":"2022-08-02T09:04:33.649099Z","shell.execute_reply.started":"2022-08-02T09:04:33.637066Z","shell.execute_reply":"2022-08-02T09:04:33.648183Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def produce_input_label_features(dataframe, drop_column, target_variable, if_inputs=True):\n    '''A function to produce a dictionary of Keras Inputs, \n    Target label and Feature columns extracted from the dataframe'''\n    \n    feature_columns = dataframe.copy()\n    feature_columns = feature_columns.drop(cols_to_drop, axis=1)\n    feature_label = feature_columns.pop(target_variable)\n\n    inputs = {}\n    for key, value in feature_columns.items():\n        dtype = value.dtype\n        \n        if dtype == 'object':\n            dtype = 'string'\n        \n        if dtype == 'int64':\n            dtype == 'int64'\n        \n        else:\n            dtype=='float64'\n        \n        inputs[key] = Input(shape=(1,), name=key, dtype=dtype)\n    \n    \n    return (inputs, feature_columns, feature_label) if if_inputs else (feature_columns, feature_label)\n\n\n\ndef dataframe_to_dataset(dataframe, label, batch_size, shuffle=True): \n    '''A function to convert Pandas Dataframe to tf.data.Dataset'''\n\n    dataset = tf.data.Dataset.from_tensor_slices((dict(dataframe), label))\n    if shuffle:\n        x = dataset.shuffle(buffer_size=(len(dataframe)))\n    x = dataset.batch(batch_size=batch_size)\n    \n    return x","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:34.201461Z","iopub.execute_input":"2022-08-02T09:04:34.202301Z","iopub.status.idle":"2022-08-02T09:04:34.211231Z","shell.execute_reply.started":"2022-08-02T09:04:34.202259Z","shell.execute_reply":"2022-08-02T09:04:34.210195Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def normalize_continous_features(dataset, inputs):\n    '''A function to Normalize the feature continous values'''\n    normalized_numeric_columns = []\n    \n    continous_numeric_inputs = {key:value for key,value in inputs.items() if value.dtype=='float64'}\n    normalizer = Normalization()\n    for key, value in continous_numeric_inputs.items():        \n        name = key\n        dataset_features = dataset.map(lambda x,y: x[name])\n        dataset_features = dataset_features.map(lambda x: tf.expand_dims(x, axis=-1))\n\n        normalizer.adapt(dataset_features)\n        print('Normalizing Continous Feature {}..'.format(key))\n        \n        normalized_numeric_columns.append(normalizer(value)) \n    \n    \n    return normalized_numeric_columns\n        \n            \ndef integer_string_lookup(dataset, inputs):\n    '''A function to convert categorical string and integer into one-hot'''\n    \n    integer_string_inputs = {key:value for key,value in inputs.items() if value.dtype !='float64'}\n    \n    encoded_integer_string = []\n    for key,value in integer_string_inputs.items():\n        if value.dtype == 'int64':\n            lookup = IntegerLookup\n            print('Encoding Categorical Integer Feature {}...'.format(key))\n        else:\n            lookup = StringLookup\n            print('Encoding String Feature {}...'.format(key))\n\n        \n        name = key\n        dataset_features = dataset.map(lambda x,y: x[name])\n        dataset_features = dataset_features.map(lambda x: tf.expand_dims(x, axis=-1))\n        \n        class_lookup = lookup(output_mode='int')\n        class_lookup.adapt(dataset_features)\n        \n        encoder = CategoryEncoding(num_tokens=class_lookup.vocabulary_size())\n        \n        x = class_lookup(value)\n        x = encoder(x)\n        \n        encoded_integer_string.append(x)\n    \n    return encoded_integer_string\n    ","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:34.670123Z","iopub.execute_input":"2022-08-02T09:04:34.670531Z","iopub.status.idle":"2022-08-02T09:04:34.682630Z","shell.execute_reply.started":"2022-08-02T09:04:34.670494Z","shell.execute_reply":"2022-08-02T09:04:34.681489Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> Dropping uneccesary columns and converting dataframe to tf.data.Dataset","metadata":{}},{"cell_type":"code","source":"cols_to_drop = ['PassengerId', 'Name', 'Cabin']\ntarget_variable = 'Transported'\n\n\n(inputs, train_feature, train_label)= produce_input_label_features(train, cols_to_drop, target_variable)\n(val_feature, val_label)= produce_input_label_features(train, cols_to_drop, target_variable, if_inputs=False)\n\ntrain_dataset = dataframe_to_dataset(train_feature, train_label, batch_size=80)\nval_dataset = dataframe_to_dataset(val_feature, val_label, batch_size=80, shuffle=False)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:35.009524Z","iopub.execute_input":"2022-08-02T09:04:35.009961Z","iopub.status.idle":"2022-08-02T09:04:35.071741Z","shell.execute_reply.started":"2022-08-02T09:04:35.009925Z","shell.execute_reply":"2022-08-02T09:04:35.070524Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> Normalize continous numerical features and Encode String and Integer Categorical features","metadata":{}},{"cell_type":"markdown","source":"> ","metadata":{}},{"cell_type":"code","source":"normalized_numeric_columns = normalize_continous_features(train_dataset, inputs)    \nencoded_integer_string = integer_string_lookup(train_dataset, inputs)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:35.360980Z","iopub.execute_input":"2022-08-02T09:04:35.361396Z","iopub.status.idle":"2022-08-02T09:04:37.238542Z","shell.execute_reply.started":"2022-08-02T09:04:35.361362Z","shell.execute_reply":"2022-08-02T09:04:37.237379Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"normalized_numeric_columns.extend(encoded_integer_string)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:37.240650Z","iopub.execute_input":"2022-08-02T09:04:37.241010Z","iopub.status.idle":"2022-08-02T09:04:37.244865Z","shell.execute_reply.started":"2022-08-02T09:04:37.240978Z","shell.execute_reply":"2022-08-02T09:04:37.244065Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"concatenated_inputs = concatenate(normalized_numeric_columns)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:37.246033Z","iopub.execute_input":"2022-08-02T09:04:37.246521Z","iopub.status.idle":"2022-08-02T09:04:37.263828Z","shell.execute_reply.started":"2022-08-02T09:04:37.246490Z","shell.execute_reply":"2022-08-02T09:04:37.262715Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preprocessing_layer = Model(inputs, concatenated_inputs)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:37.265949Z","iopub.execute_input":"2022-08-02T09:04:37.266280Z","iopub.status.idle":"2022-08-02T09:04:37.274551Z","shell.execute_reply.started":"2022-08-02T09:04:37.266249Z","shell.execute_reply":"2022-08-02T09:04:37.273538Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"input_tensor = preprocessing_layer(inputs)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:37.275901Z","iopub.execute_input":"2022-08-02T09:04:37.276508Z","iopub.status.idle":"2022-08-02T09:04:37.368899Z","shell.execute_reply.started":"2022-08-02T09:04:37.276447Z","shell.execute_reply":"2022-08-02T09:04:37.367748Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> Structure a Model","metadata":{}},{"cell_type":"code","source":"optimizer = tf.keras.optimizers.RMSprop(.0001)\ncallbacks = keras.callbacks.EarlyStopping(monitor='accuracy', patience=10)\n\ndense1 = Dense(128, activation='relu')(input_tensor)\ndense2 = Dense(64, activation='relu')(dense1)\ndropout1 = Dropout(0.2)(dense2)\n\ndense3 = Dense(64, activation='relu')(dropout1)\ndense4 = Dense(32, activation='relu')(dense3)\ndropout2 = Dropout(0.3)(dense4)\n\ndense5 = Dense(32, activation='relu')(dropout2)\noutput = Dense(1, activation='sigmoid')(dense5)\n\nmodel = Model(inputs, output)\n\nmodel.compile(optimizer=optimizer, metrics=['accuracy'], loss='binary_crossentropy')\nhistory = model.fit(train_dataset, epochs=1000, validation_data=val_dataset, callbacks=[callbacks], verbose=0)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:04:38.038270Z","iopub.execute_input":"2022-08-02T09:04:38.038694Z","iopub.status.idle":"2022-08-02T09:05:05.507463Z","shell.execute_reply.started":"2022-08-02T09:04:38.038656Z","shell.execute_reply":"2022-08-02T09:05:05.506132Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"hist = pd.DataFrame(history.history)\nhist['epoch'] = history.epoch\nhist.tail()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:05:05.511428Z","iopub.execute_input":"2022-08-02T09:05:05.512061Z","iopub.status.idle":"2022-08-02T09:05:05.525884Z","shell.execute_reply.started":"2022-08-02T09:05:05.512023Z","shell.execute_reply":"2022-08-02T09:05:05.525094Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def plot_model_statistics(dataframe, loss=True):\n    if loss:\n        plt.figure(figsize=(14,6))\n        plt.title('Model Loss')\n        plt.plot(hist['loss'], label='loss')\n        plt.plot(hist['val_loss'], label='val_loss')\n        plt.xlabel('Epochs')\n        plt.ylabel('Loss rate')\n        plt.legend()\n        plt.grid(True)\n        plt.show()\n    \n    else:\n        plt.figure(figsize=(14,6))\n        plt.title('Model Accuracy')\n\n        plt.plot(hist['accuracy'], label='accuracy')\n        plt.plot(hist['val_accuracy'], label='val_accuracy')\n        plt.xlabel('Epochs')\n        plt.ylabel('Accuracy rate')\n        plt.legend()\n        plt.grid(True)\n        plt.show()\n","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:05:05.527576Z","iopub.execute_input":"2022-08-02T09:05:05.528219Z","iopub.status.idle":"2022-08-02T09:05:05.542699Z","shell.execute_reply.started":"2022-08-02T09:05:05.528186Z","shell.execute_reply":"2022-08-02T09:05:05.541798Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> Plot Model Statistics","metadata":{}},{"cell_type":"code","source":"plot_model_statistics(hist, loss=False)\nplot_model_statistics(hist)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:05:05.545811Z","iopub.execute_input":"2022-08-02T09:05:05.546535Z","iopub.status.idle":"2022-08-02T09:05:05.987621Z","shell.execute_reply.started":"2022-08-02T09:05:05.546488Z","shell.execute_reply":"2022-08-02T09:05:05.986456Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> Prepare test data for prediction","metadata":{}},{"cell_type":"code","source":"test_bool_columns = ['VIP', 'CryoSleep']\ndrop_columns = ['Name', 'Cabin']\n\ndef test_dataframe_to_dataset(dataframe, drop_column, bool_columns):\n    '''A function to convert test dataframe to tf.data.Dataset'''\n    \n    feature_columns = dataframe.copy()\n    feature_columns = feature_columns.drop(drop_column, axis=1)\n    passenger_id = feature_columns.pop('PassengerId')\n    \n    for column in bool_columns:\n            feature_columns[column] = np.where(feature_columns[column] == False, 0, 1)\n    \n    dataset = tf.data.Dataset.from_tensor_slices((dict(feature_columns)))\n    \n    \n    return dataset, passenger_id\n","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:05:05.988913Z","iopub.execute_input":"2022-08-02T09:05:05.989281Z","iopub.status.idle":"2022-08-02T09:05:05.996608Z","shell.execute_reply.started":"2022-08-02T09:05:05.989247Z","shell.execute_reply":"2022-08-02T09:05:05.995497Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> Test data has missing values, fill using single imputation method","metadata":{}},{"cell_type":"code","source":"test_numerical, test_categorical = num_cat(y)\nsingle_imputation(y, test_numerical, numeric=True)\nsingle_imputation(y, test_categorical)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:05:05.997937Z","iopub.execute_input":"2022-08-02T09:05:05.998297Z","iopub.status.idle":"2022-08-02T09:05:06.028887Z","shell.execute_reply.started":"2022-08-02T09:05:05.998265Z","shell.execute_reply":"2022-08-02T09:05:06.027909Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> Convert test dataframe to tf.data.Dataset","metadata":{}},{"cell_type":"code","source":"(test_dataset, passenger_id) = test_dataframe_to_dataset(y, drop_columns, test_bool_columns)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:05:06.030457Z","iopub.execute_input":"2022-08-02T09:05:06.031539Z","iopub.status.idle":"2022-08-02T09:05:06.056407Z","shell.execute_reply.started":"2022-08-02T09:05:06.031493Z","shell.execute_reply":"2022-08-02T09:05:06.055194Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> Predict test data by batches","metadata":{}},{"cell_type":"code","source":"result = model.predict(test_dataset.batch(32))","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:05:06.058122Z","iopub.execute_input":"2022-08-02T09:05:06.058471Z","iopub.status.idle":"2022-08-02T09:05:06.605912Z","shell.execute_reply.started":"2022-08-02T09:05:06.058438Z","shell.execute_reply":"2022-08-02T09:05:06.604886Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> Save prediction result to sumbission.csv","metadata":{}},{"cell_type":"code","source":"result_dict = {'PassengerId':passenger_id, 'Transported': result.flatten() > 0.498}\nresult_dataframe = pd.DataFrame(result_dict)\nresult_dataframe.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:05:06.607718Z","iopub.execute_input":"2022-08-02T09:05:06.608524Z","iopub.status.idle":"2022-08-02T09:05:06.621167Z","shell.execute_reply.started":"2022-08-02T09:05:06.608477Z","shell.execute_reply":"2022-08-02T09:05:06.620202Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"result_dataframe.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:05:06.624646Z","iopub.execute_input":"2022-08-02T09:05:06.625247Z","iopub.status.idle":"2022-08-02T09:05:06.634782Z","shell.execute_reply.started":"2022-08-02T09:05:06.625214Z","shell.execute_reply":"2022-08-02T09:05:06.633750Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"result_dataframe.Transported.value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T09:05:06.636153Z","iopub.execute_input":"2022-08-02T09:05:06.637067Z","iopub.status.idle":"2022-08-02T09:05:06.651510Z","shell.execute_reply.started":"2022-08-02T09:05:06.637034Z","shell.execute_reply":"2022-08-02T09:05:06.650430Z"},"trusted":true},"execution_count":null,"outputs":[]}]}