{"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":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session\nimport matplotlib\n%matplotlib inline","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-08-01T14:34:19.614360Z","iopub.execute_input":"2022-08-01T14:34:19.614786Z","iopub.status.idle":"2022-08-01T14:34:19.632008Z","shell.execute_reply.started":"2022-08-01T14:34:19.614750Z","shell.execute_reply":"2022-08-01T14:34:19.630774Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = pd.read_csv(\"../input/data-science-and-stem-salaries/Levels_Fyi_Salary_Data.csv\")\ntrain.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T14:34:19.634314Z","iopub.execute_input":"2022-08-01T14:34:19.635084Z","iopub.status.idle":"2022-08-01T14:34:19.988147Z","shell.execute_reply.started":"2022-08-01T14:34:19.635042Z","shell.execute_reply":"2022-08-01T14:34:19.986853Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display(train.info())\ntrain.describe()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T14:34:19.989674Z","iopub.execute_input":"2022-08-01T14:34:19.989982Z","iopub.status.idle":"2022-08-01T14:34:20.161068Z","shell.execute_reply.started":"2022-08-01T14:34:19.989956Z","shell.execute_reply":"2022-08-01T14:34:20.160149Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Univariate analysis\nimport warnings\nwarnings.filterwarnings(\"ignore\")\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nfor c in train.columns:\n    if train[c].dtype in ['object','bool']: #categorical column\n        if (len(train[c].unique())>50):\n            print(str(c) + \" has >50 categories and is unable to display properly\")\n            continue\n        plt.figure(figsize=(10,5))\n        ax=sns.countplot(train[c],palette='magma')\n        ax.set_xticklabels(ax.get_xticklabels(), rotation=40, ha=\"right\")\n        plt.show()\n    else: #numerical column\n        plt.figure(figsize=(10,5))\n        sns.histplot(train[c],kde=(len(train[c].unique())>10),color='purple')\n        plt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T14:36:34.619277Z","iopub.execute_input":"2022-08-01T14:36:34.619715Z","iopub.status.idle":"2022-08-01T14:36:50.177964Z","shell.execute_reply.started":"2022-08-01T14:36:34.619678Z","shell.execute_reply":"2022-08-01T14:36:50.176909Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20, 10))\nsns.heatmap(train.corr(), annot=True, vmin=-1, vmax=1, cmap=\"coolwarm\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T14:34:36.366867Z","iopub.execute_input":"2022-08-01T14:34:36.368185Z","iopub.status.idle":"2022-08-01T14:34:38.214609Z","shell.execute_reply.started":"2022-08-01T14:34:36.368007Z","shell.execute_reply":"2022-08-01T14:34:38.213502Z"},"trusted":true},"execution_count":null,"outputs":[]}]}