{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\nimport os\nprint(os.listdir(\"../input\"))","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"train = pd.read_csv('../input/train.csv')\nprint(train.shape)\ntrain.head(5)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"7a1d9bdf9ea8d3777dbbd9fd47e0931e0ae169d1"},"cell_type":"code","source":"stats = []\nfor col in train.columns:\n    stats.append((col, train[col].nunique(), train[col].isnull().sum() * 100 / train.shape[0], train[col].value_counts(normalize=True, dropna=False).values[0] * 100, train[col].dtype))\nstats_df = pd.DataFrame(stats, columns=['Feature', 'Unique_values', 'Percentage of missing values', 'Percentage of values in the biggest category', 'type'])\nstats_df.sort_values('Percentage of missing values', ascending=False)[:10]","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-output":false,"_kg_hide-input":false,"trusted":true,"scrolled":false,"_uuid":"fb4e8e065352afeac3dab0cb07d111d5b5d1c9ac"},"cell_type":"code","source":"import matplotlib.pyplot as plt\nimport seaborn as sns\nimport warnings\nwarnings.simplefilter(action='ignore', category=FutureWarning)\nwarnings.filterwarnings(\"ignore\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"5e31709764ea33e70817472bc5e72ea202465a85"},"cell_type":"code","source":"target_col = \"target\"\n\nplt.figure(figsize=(16,6))\nplt.subplot(1,2,1)\nplt.scatter(range(train.shape[0]), np.sort(train[target_col].values))\nplt.xlabel('index', fontsize=12)\nplt.ylabel('target', fontsize=12)\nplt.subplot(1,2,2)\nsns.distplot(train[target_col].values, bins=50, kde=False, color=\"red\")\nplt.title(\"Histogram of target\")\nplt.xlabel('target', fontsize=12)\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"12ab640499438ade176d6a87dcca6f0d8ed15e0f"},"cell_type":"code","source":"target_col = \"target\"\ntab = {'1':'feature_1','2':'feature_2','3':'feature_3'}\nplt.figure(figsize=(24,8))\nfor i,j in tab.items():\n    i = int(i)\n    plt.subplot(1,3,i)\n    plt.scatter(train[j], train[target_col].values)\n    plt.xlabel(j, fontsize=12)\n    if i==1:\n        plt.ylabel('target', fontsize=12)\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"297d3450eabbc31c456e462846be2c047276b22c"},"cell_type":"code","source":"sns.pairplot(train, hue='feature_1', vars=['feature_2', 'feature_3', 'target'], palette='viridis')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"6389d84d16c8d5f817a9cc6a9f47a290c2818dd5"},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}