<jupyter_start><jupyter_text>The most Trending programming languages used in egypt last 3 years !!! We Will Go Throudg data analysis using Stackoverflow’s 2017,2018 and 2019 Annual Developer Survey. <img src="programmin.jpg"     alt="Markdown Monster icon"     style="float: left; margin-right: 10px;" />  Introduction<jupyter_code>import numpy as np
import pandas as pd
from collections import Counter

# to visualise al the columns in the dataframe
pd.pandas.set_option('display.max_columns', None)

# to make plots
import matplotlib.pyplot as plt
%matplotlib inline

# to change plot style
# sns.set(style="darkgrid")

# to ignore warnings
import warnings
warnings.filterwarnings("ignore")
%matplotlib inline
df2019=pd.read_csv("2019/survey_results_public.csv")
df2018=pd.read_csv("2018/survey_results_public.csv")
df2017=pd.read_csv("2017/survey_results_public.csv")<jupyter_output><empty_output><jupyter_text>UnderstandingData let's have a quick look on Data<jupyter_code>df2018.info()
df2017.head()<jupyter_output><empty_output><jupyter_text>1-What are The kinds of developers?<jupyter_code>def display_bar_chart(df, column, title):
    '''
    Displays a bar chart with a title
    Returns:None
    
    '''
    status_vals = df[column].value_counts()
    dfp=(status_vals[:10]/df.shape[0])
    dfp.sort_values().plot(kind="barh");
    plt.title(title);
display_bar_chart(df2017, "Professional", "kinds of developers")<jupyter_output><empty_output><jupyter_text>2-what is egyptien developers ratio all over the wold?<jupyter_code>dfco = df2017.query("Country=='Egypt'")
ratio=dfco.shape[0]/df2017.shape[0]*100
print("egyption developers",ratio,"%")<jupyter_output>egyption developers 0.2607409713574097 %<jupyter_text>3-what is the ratio of males and females devolpers in egypt?<jupyter_code>d1=df2017.query("Country=='Egypt'")
d1=d1["Gender"].value_counts()
fig = plt.figure()
ax = fig.add_axes([0,0,1,1])
ax.axis('equal')
explode = (0.1, 0.1, 0)
d1.plot(kind="pie", shadow=True,explode=explode,autopct='%1.2f%%')<jupyter_output><empty_output><jupyter_text>4-What programming languages are most used to work in egypt last 3 years? 5-which programming languages are most required in egypt last 3 years?<jupyter_code>def get_countery_data(df,country_col,country_name,columns):
    ''' grouping by countery '''
    df_copy =df 
    for column in columns:
        df_copy=df_copy[df_copy[country_col]==country_name].dropna(subset=[column])
    return df_copy 
egypt2017=get_countery_data(df2017, 'Country', 'Egypt', ['HaveWorkedLanguage', 'WantWorkLanguage'])
egypt2018=get_countery_data(df2018, 'Country', 'Egypt', ['LanguageWorkedWith', 'LanguageDesireNextYear'])
egypt2019=get_countery_data(df2019, 'Country', 'Egypt', ['LanguageWorkedWith', 'LanguageDesireNextYear'])
def split_column(df, column):
    ''' Split column by ;,
        returns a splited series.
    '''
    
    df_copy = df
    column_series = df_copy[column].apply(lambda x: x.split(';'))
    
    return column_series
# Splitting the Data Frame by column into a Series. 
worked_lang_2017 = split_column(egypt2017, 'HaveWorkedLanguage')
wanted_lang_2017 = split_column(egypt2017, 'WantWorkLanguage')

worked_lang_2018 = split_column(egypt2018, 'LanguageWorkedWith')
wanted_lang_2018 = split_column(egypt2018, 'LanguageDesireNextYear')

worked_lang_2019 = split_column(egypt2019, 'LanguageWorkedWith')
wanted_lang_2019 = split_column(egypt2019, 'LanguageDesireNextYear')
def disarray(array_list):
    ''' Flat a nested list,
        returns a flat list.
    '''
    
    objects = []
    
    for row in array_list:
        for obj in row:
            objects.append(obj.strip())
            
    return objects

# Flatting nested list objects.
list_worked_languages_2017 = disarray(worked_lang_2017)
list_wanted_languages_2017 = disarray(wanted_lang_2017)

list_worked_languages_2018 = disarray(worked_lang_2018)
list_wanted_languages_2018 = disarray(wanted_lang_2018)

list_worked_languages_2019 = disarray(worked_lang_2019)
list_wanted_languages_2019 = disarray(wanted_lang_2019)
def group_list(data_list, year):
    ''' Group by count to a list,
        returns a result dict.
    '''
    grouped_list = dict(Counter(data_list))
    grouped_dict = [{'Programming Language':key, 'Count': value, 'Year': year} for key, value in grouped_list.items()]
    
    return grouped_dict

# Groping a list and creating a dict.
dict_worked_languages_2017 = group_list(list_worked_languages_2017, '2017')
dict_wanted_languages_2017 = group_list(list_wanted_languages_2017, '2017')

dict_worked_languages_2018 = group_list(list_worked_languages_2018, '2018')
dict_wanted_languages_2018 = group_list(list_wanted_languages_2018, '2018')

dict_worked_languages_2019 = group_list(list_worked_languages_2019, '2019')
dict_wanted_languages_2019 = group_list(list_wanted_languages_2019, '2019')

dict_worked_languages_2019
df1_1=pd.DataFrame(dict_worked_languages_2017).sort_values(by=['Count'], ascending=False).head(10)
df1_2=pd.DataFrame(dict_wanted_languages_2017).sort_values(by=['Count'], ascending=False).head(10)
df2_1=pd.DataFrame(dict_worked_languages_2018).sort_values(by=['Count'], ascending=False).head(10)
df2_2=pd.DataFrame(dict_wanted_languages_2018).sort_values(by=['Count'], ascending=False).head(10)
df3_1=pd.DataFrame(dict_worked_languages_2019).sort_values(by=['Count'], ascending=False).head(10)
df3_2=pd.DataFrame(dict_wanted_languages_2019).sort_values(by=['Count'], ascending=False).head(10)

df3_1
ax1=df1_1.plot.bar(x="Programming Language",y="Count",edgecolor="orange")
plt.title("top 10 programming languages worked in egypt 2017");
ax1=df1_2.plot.bar(x="Programming Language",y="Count",color="orange",edgecolor="blue")
plt.title("top 10 programming languages wanted in egypt 2017");
ax1=df2_1.plot.bar(x="Programming Language",y="Count",edgecolor="orange")
plt.title("top 10 programming languages worked in egypt 2018");
ax1=df2_2.plot.bar(x="Programming Language",y="Count",color="orange",edgecolor="blue")
plt.title("top 10 programming languages wanted in egypt 2018");
ax1=df3_1.plot.bar(x="Programming Language",y="Count",edgecolor="orange")
plt.title("top 10 programming languages worked in egypt 2019");
ax1=df3_2.plot.bar(x="Programming Language",y="Count",color="orange",edgecolor="blue")
plt.title("top 10 programming languages wanted in egypt 2019");<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12343161856963614, 'fraction_numerical': 0.06430363864491845, 'mean_word_length': 7.10292249047014, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '309370', 'license': 'CNRI-Python', 'n_tokens_mistral': 2497, 'n_tokens_neox': 2152, 'n_words': 414, 'path': '.ipynb_checkpoints/Survey_analysis-checkpoint.ipynb', 'repo_name': 'hima888/Write-a-Data-Science-Blog-Post-from-Annual-Developer-Survey-data', 'size': '6376'}