{"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","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-08-13T12:05:03.879130Z","iopub.execute_input":"2022-08-13T12:05:03.879644Z","iopub.status.idle":"2022-08-13T12:05:03.891673Z","shell.execute_reply.started":"2022-08-13T12:05:03.879599Z","shell.execute_reply":"2022-08-13T12:05:03.890364Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv(\"../input/kaggle-survey-2021/kaggle_survey_2021_responses.csv\")\ndf.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:03.900613Z","iopub.execute_input":"2022-08-13T12:05:03.901075Z","iopub.status.idle":"2022-08-13T12:05:05.216461Z","shell.execute_reply.started":"2022-08-13T12:05:03.901035Z","shell.execute_reply":"2022-08-13T12:05:05.215246Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Q = df.iloc[:0]\nprint(Q)","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:05.219053Z","iopub.execute_input":"2022-08-13T12:05:05.219567Z","iopub.status.idle":"2022-08-13T12:05:05.228891Z","shell.execute_reply.started":"2022-08-13T12:05:05.219527Z","shell.execute_reply":"2022-08-13T12:05:05.227685Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = df.drop(df.index[0])","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:05.230430Z","iopub.execute_input":"2022-08-13T12:05:05.231133Z","iopub.status.idle":"2022-08-13T12:05:05.392902Z","shell.execute_reply.started":"2022-08-13T12:05:05.231093Z","shell.execute_reply":"2022-08-13T12:05:05.391445Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:05.395489Z","iopub.execute_input":"2022-08-13T12:05:05.395851Z","iopub.status.idle":"2022-08-13T12:05:05.422043Z","shell.execute_reply.started":"2022-08-13T12:05:05.395818Z","shell.execute_reply":"2022-08-13T12:05:05.420675Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for col in df.columns :\n    if df[col].str.isnumeric().all():\n        df[col] = pd.to_numeric(df[col])","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:05.423797Z","iopub.execute_input":"2022-08-13T12:05:05.424435Z","iopub.status.idle":"2022-08-13T12:05:10.432178Z","shell.execute_reply.started":"2022-08-13T12:05:05.424387Z","shell.execute_reply":"2022-08-13T12:05:10.430908Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.info()","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:10.433864Z","iopub.execute_input":"2022-08-13T12:05:10.435526Z","iopub.status.idle":"2022-08-13T12:05:10.503137Z","shell.execute_reply.started":"2022-08-13T12:05:10.435471Z","shell.execute_reply":"2022-08-13T12:05:10.501801Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cantres = df['Q3'].unique()\nprint(cantres)","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:10.504812Z","iopub.execute_input":"2022-08-13T12:05:10.506360Z","iopub.status.idle":"2022-08-13T12:05:10.516389Z","shell.execute_reply.started":"2022-08-13T12:05:10.506304Z","shell.execute_reply":"2022-08-13T12:05:10.515062Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"counties_str = \"Algeria, Bahrain, Comoros, Djibouti, Egypt, Iraq, Jordan, Kuwait, Lebanon, Libya, Mauritania, Morocco, Oman, Palestine, Qatar, Saudi Arabia, Somalia, Sudan, Syria, Tunisia, United Arab Emirates, Yemen\"\narab_cunt = counties_str.split(\", \")\n","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:10.518173Z","iopub.execute_input":"2022-08-13T12:05:10.518926Z","iopub.status.idle":"2022-08-13T12:05:10.526149Z","shell.execute_reply.started":"2022-08-13T12:05:10.518878Z","shell.execute_reply":"2022-08-13T12:05:10.525210Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_arab = df[df['Q3'].isin(arab_cunt)]","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:10.527787Z","iopub.execute_input":"2022-08-13T12:05:10.528588Z","iopub.status.idle":"2022-08-13T12:05:10.579031Z","shell.execute_reply.started":"2022-08-13T12:05:10.528541Z","shell.execute_reply":"2022-08-13T12:05:10.577812Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_arab.shape","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:10.583551Z","iopub.execute_input":"2022-08-13T12:05:10.584208Z","iopub.status.idle":"2022-08-13T12:05:10.593544Z","shell.execute_reply.started":"2022-08-13T12:05:10.584147Z","shell.execute_reply":"2022-08-13T12:05:10.591609Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_arab['Q3'].unique()","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:10.595703Z","iopub.execute_input":"2022-08-13T12:05:10.596821Z","iopub.status.idle":"2022-08-13T12:05:10.606143Z","shell.execute_reply.started":"2022-08-13T12:05:10.596768Z","shell.execute_reply":"2022-08-13T12:05:10.604619Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# # line plot for age distripution in arabic world","metadata":{}},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nplt.figure(figsize=(10,8))\nplt.style.use('ggplot')\nvalue = df_arab['Q1'].value_counts().sort_index()\nind = value.index\nplt.plot(ind,value)\nplt.title('age distripution in arabic world')\nplt.xlabel('ages')\nplt.ylabel('counts')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:10.607840Z","iopub.execute_input":"2022-08-13T12:05:10.609208Z","iopub.status.idle":"2022-08-13T12:05:10.862787Z","shell.execute_reply.started":"2022-08-13T12:05:10.609138Z","shell.execute_reply":"2022-08-13T12:05:10.861566Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# # country distrepution","metadata":{}},{"cell_type":"code","source":"country = df_arab['Q3'].value_counts()\nplt.figure(figsize=(10,8))\nplt.bar(country.index,country)\nplt.title('countrys distripution in arabic world')\nplt.xlabel('countrys')\nplt.ylabel('counts')\nplt.xticks(rotation=45)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:10.864601Z","iopub.execute_input":"2022-08-13T12:05:10.865103Z","iopub.status.idle":"2022-08-13T12:05:11.105691Z","shell.execute_reply.started":"2022-08-13T12:05:10.865057Z","shell.execute_reply":"2022-08-13T12:05:11.104444Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# # arab kaggle users distrpution by programing languages","metadata":{}},{"cell_type":"code","source":"Q7col = df_arab.columns[df_arab.columns.str.contains('Q7')]","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:11.107231Z","iopub.execute_input":"2022-08-13T12:05:11.107673Z","iopub.status.idle":"2022-08-13T12:05:11.115039Z","shell.execute_reply.started":"2022-08-13T12:05:11.107636Z","shell.execute_reply":"2022-08-13T12:05:11.113562Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\ndic7 = dict()\nfor i in Q7col:\n    key = df_arab[i].value_counts().index[0]\n    dic7[key] = df_arab[i].value_counts()[0]\ns7 = pd.Series(dic7)\nplt.figure(figsize=(12,9))\nplt.pie(s7.values,labels=s7.index,autopct='%1.1f%%')\nplt.legend(s7.index)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:11.116884Z","iopub.execute_input":"2022-08-13T12:05:11.117286Z","iopub.status.idle":"2022-08-13T12:05:11.560644Z","shell.execute_reply.started":"2022-08-13T12:05:11.117251Z","shell.execute_reply":"2022-08-13T12:05:11.559359Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib as mp\nplt.figure(figsize=(10,8))\nplt.bar(s7.index,s7.sort_values(ascending=False),color=('#93FFFF','#89FFFF','#7FFFFF' ,'#75F8FF','#6BEEFF','#61E4F9','#57DAEF','#4DD0E5','#39BCD1','#39BCD1','#39BCD1','#2FB2C7','#25A8BD','#1B9EB3','#1194A9'))\nplt.title('countrys distripution in arabic world',fontsize=22)\nplt.xlabel('programing languages',fontsize=18,)\nplt.ylabel('counts',fontsize=18)\nplt.xticks(rotation=75)\nplt.yticks(rotation=75)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:11.562842Z","iopub.execute_input":"2022-08-13T12:05:11.563804Z","iopub.status.idle":"2022-08-13T12:05:11.852372Z","shell.execute_reply.started":"2022-08-13T12:05:11.563747Z","shell.execute_reply":"2022-08-13T12:05:11.850543Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(12,9))\nexplode = [0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1]\nplt.pie(s7.values,labels=s7.index,autopct='%1.1f%%',explode=explode,colors=('#93FFFF','#89FFFF','#7FFFFF' ,'#75F8FF','#6BEEFF','#61E4F9','#57DAEF','#4DD0E5','#39BCD1','#39BCD1','#39BCD1','#2FB2C7','#25A8BD','#1B9EB3','#1194A9'))\nplt.legend(s7.index)\nplt.show() ","metadata":{"execution":{"iopub.status.busy":"2022-08-13T12:05:11.854357Z","iopub.execute_input":"2022-08-13T12:05:11.854871Z","iopub.status.idle":"2022-08-13T12:05:12.277555Z","shell.execute_reply.started":"2022-08-13T12:05:11.854831Z","shell.execute_reply":"2022-08-13T12:05:12.276241Z"},"trusted":true},"execution_count":null,"outputs":[]}]}