{"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":"code","source":"import pandas as pd\nimport numpy as np\n\nimport matplotlib.pyplot as plt\nimport seaborn as sns","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-08-01T10:43:51.291394Z","iopub.execute_input":"2022-08-01T10:43:51.291776Z","iopub.status.idle":"2022-08-01T10:43:51.296594Z","shell.execute_reply.started":"2022-08-01T10:43:51.291731Z","shell.execute_reply":"2022-08-01T10:43:51.295658Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df = pd.read_csv(\"../input/titanic/train.csv\")\ntest_df = pd.read_csv(\"../input/titanic/test.csv\")\ntest_PassengerId = test_df[\"PassengerId\"]","metadata":{"execution":{"iopub.status.busy":"2022-08-01T10:43:51.313362Z","iopub.execute_input":"2022-08-01T10:43:51.313803Z","iopub.status.idle":"2022-08-01T10:43:51.328706Z","shell.execute_reply.started":"2022-08-01T10:43:51.313774Z","shell.execute_reply":"2022-08-01T10:43:51.328039Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.columns","metadata":{"execution":{"iopub.status.busy":"2022-08-01T10:43:51.337933Z","iopub.execute_input":"2022-08-01T10:43:51.338399Z","iopub.status.idle":"2022-08-01T10:43:51.343987Z","shell.execute_reply.started":"2022-08-01T10:43:51.338371Z","shell.execute_reply":"2022-08-01T10:43:51.343342Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T10:43:51.362121Z","iopub.execute_input":"2022-08-01T10:43:51.362909Z","iopub.status.idle":"2022-08-01T10:43:51.377241Z","shell.execute_reply.started":"2022-08-01T10:43:51.362876Z","shell.execute_reply":"2022-08-01T10:43:51.376376Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.describe()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T10:43:51.387922Z","iopub.execute_input":"2022-08-01T10:43:51.388447Z","iopub.status.idle":"2022-08-01T10:43:51.420908Z","shell.execute_reply.started":"2022-08-01T10:43:51.388407Z","shell.execute_reply":"2022-08-01T10:43:51.419488Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.info()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T10:43:51.422902Z","iopub.execute_input":"2022-08-01T10:43:51.423499Z","iopub.status.idle":"2022-08-01T10:43:51.437934Z","shell.execute_reply.started":"2022-08-01T10:43:51.423456Z","shell.execute_reply":"2022-08-01T10:43:51.436969Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def bar_plot(variable):\n    var = train_df[variable]\n    varValue = var.value_counts()\n    \n    plt.figure(figsize=(9, 3))\n    plt.bar(varValue.index, varValue)\n    plt.xticks(varValue.index, varValue.index.values)\n    plt.ylabel(\"Frequency\")\n    plt.title(variable)\n    plt.show()\n    print(\"{}: \\n {}\".format(variable,varValue))    ","metadata":{"execution":{"iopub.status.busy":"2022-08-01T10:43:51.439370Z","iopub.execute_input":"2022-08-01T10:43:51.440146Z","iopub.status.idle":"2022-08-01T10:43:51.446684Z","shell.execute_reply.started":"2022-08-01T10:43:51.440117Z","shell.execute_reply":"2022-08-01T10:43:51.445961Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"category1 = [\"Survived\",\"Sex\",\"Pclass\",\"Embarked\",\"SibSp\", \"Parch\"]\nfor c in category1:\n    bar_plot(c)","metadata":{"execution":{"iopub.status.busy":"2022-08-01T10:43:51.447918Z","iopub.execute_input":"2022-08-01T10:43:51.448337Z","iopub.status.idle":"2022-08-01T10:43:52.358316Z","shell.execute_reply.started":"2022-08-01T10:43:51.448312Z","shell.execute_reply":"2022-08-01T10:43:52.356615Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"category2 = [\"Cabin\", \"Name\", \"Ticket\"]\nfor c in category2:\n    print(\"{} \\n\".format(train_df[c].value_counts()))","metadata":{"execution":{"iopub.status.busy":"2022-08-01T10:43:52.360491Z","iopub.execute_input":"2022-08-01T10:43:52.361014Z","iopub.status.idle":"2022-08-01T10:43:52.376320Z","shell.execute_reply.started":"2022-08-01T10:43:52.360971Z","shell.execute_reply":"2022-08-01T10:43:52.375187Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}