File size: 7,078 Bytes
6343888
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#### function to show map for loaction of the job
import time
import matplotlib.pyplot as plt 
import seaborn as sns 
import matplotlib as mpl
import plotly 
import plotly.express as px
import plotly.graph_objs as go
import plotly.offline as py
from plotly.offline import iplot
from plotly.subplots import make_subplots
import plotly.figure_factory as ff



def map_bubble(df):
  
  import requests
  import urllib.parse
  g =[]
  for i  in range(len(df.Location)):

    if  df.Location.loc[i].split(","):
      g.append(df.Location.loc[i].split(",")[0])
    else:
      g.append(df.Location.loc[i])
  df['new_loc']=g 
  if 'country' in df.columns:
    df["full_location"] = df["new_loc"] + ", " +df["country"]
    dict_cities = dict(df.full_location.value_counts())
  else :
    dict_cities = dict(df.new_loc.value_counts())
  lat = []
  lon = []
  bubble_df = pd.DataFrame()
  add=[]
  val=[]
  try:
    for address in dict_cities.keys():
      url = 'https://nominatim.openstreetmap.org/search/' + urllib.parse.quote(address) +'?format=json'

      response = requests.get(url).json()
      lat.append(response[0]["lat"])
      lon.append(response[0]["lon"])
      add.append(address)
      val.append(dict_cities[address])
  except:
    pass

  bubble_df['address'] =add
  bubble_df['lat'] = lat
  bubble_df['lon'] = lon
  bubble_df['value'] = val


  # import the library
  import folium

  # Make an empty map
  m = folium.Map(location=[20,0], tiles="OpenStreetMap", zoom_start=2)
  # add marker one by one on the map
  for i in range(0,len(bubble_df)):
    folium.Circle(
        location=[bubble_df.iloc[i]['lat'], bubble_df.iloc[i]['lon']],

        popup=bubble_df.iloc[i][['address','value']].values,
        radius=float(bubble_df.iloc[i]['value'])*500,
        color='#69b3a2',
        fill=True,
        fill_color='#69b3a2'
    ).add_to(m)
  m
  # Show the map again
  return m


##########################





#########################
#### wuzzuf analysis
def wuzzuf_exp(df1):
  top10_job_title = df1['Title'].value_counts()[:10]
  fig1 = px.bar(y=top10_job_title.values, 
              x=top10_job_title.index, 
              color = top10_job_title.index,
              color_discrete_sequence=px.colors.sequential.deep,
              text=top10_job_title.values,
              title= 'Top 10 Job Titles',
              template= 'plotly_dark')
  fig1.update_layout(height=500,width=500, 
      xaxis_title="Job Titles",
      yaxis_title="count",
      font = dict(size=17,family="Franklin Gothic"))
  st.plotly_chart(fig1)

  type_grouped = df1['Career_Level'].value_counts()
  #e_type = ['Full-Time','Part-Time','Contract','Freelance']
  e_type =dict(df1['Career_Level'].value_counts()).keys()
  fig2 = px.bar(x = e_type, y = type_grouped.values, 
        color = type_grouped.index, 
        color_discrete_sequence=px.colors.sequential.dense,
        template = 'plotly_dark',
        text = type_grouped.values, title = 'Career Level Distribution')
  fig2.update_layout( height=500, width=500,
      xaxis_title="Career Level",
      yaxis_title="count",
      font = dict(size=17,family="Franklin Gothic"))
  fig2.update_traces(width=0.5)
  st.plotly_chart(fig2)
  residence = df1['Location'].value_counts()
  top10_employee_location = residence[:10]
  fig3 = px.bar(y=top10_employee_location.values, 
              x=top10_employee_location.index, 
              color = top10_employee_location.index,
              color_discrete_sequence=px.colors.sequential.deep,
              text=top10_employee_location.values,
              title= 'Top 10 Location of job',
              template= 'plotly_dark')
  fig3.update_layout(height=500,width=500,
      xaxis_title="Location of job",
      yaxis_title="count",
      font = dict(size=17,family="Franklin Gothic"))
  st.plotly_chart(fig3)
    
  type_grouped = df1['Experience_Needed'].value_counts()
  #e_type = ['Full-Time','Part-Time','Contract','Freelance']
  e_type =dict(df1['Experience_Needed'].value_counts()).keys()
  fig4 = px.bar(x = e_type, y = type_grouped.values, 
        color = type_grouped.index, 
        color_discrete_sequence=px.colors.sequential.dense,
        template = 'plotly_dark',
        text = type_grouped.values, title = ' Experience Level Distribution')
  fig4.update_layout(height=500,width=500,
      xaxis_title=" Experience Level (years)",
      yaxis_title="count",
      font = dict(size=17,family="Franklin Gothic"))
  fig4.update_traces(width=0.5)
  st.plotly_chart(fig4)
  return 



#########################
### linkedin analysis

def linkedin_exp(df1):
  top10_job_title = df1['Title'].value_counts()[:10]
  fig1 = px.bar(y=top10_job_title.values, 
              x=top10_job_title.index, 
              color = top10_job_title.index,
              color_discrete_sequence=px.colors.sequential.deep,
              text=top10_job_title.values,
              title= 'Top 10 Job Titles',
              template= 'plotly_dark')
  fig1.update_layout(height=500,width=500, 
      xaxis_title="Job Titles",
      yaxis_title="count",
      font = dict(size=17,family="Franklin Gothic"))
  st.plotly_chart(fig1)

  type_grouped = df1['Employment type'].value_counts()
  #e_type = ['Full-Time','Part-Time','Contract','Freelance']
  e_type =dict(df1['Employment type'].value_counts()).keys()
  fig2 = px.bar(x = e_type, y = type_grouped.values, 
        color = type_grouped.index, 
        color_discrete_sequence=px.colors.sequential.dense,
        template = 'plotly_dark',
        text = type_grouped.values, title = 'Employment type Distribution')
  fig2.update_layout( height=500, width=500,
      xaxis_title="Employment type",
      yaxis_title="count",
      font = dict(size=17,family="Franklin Gothic"))
  fig2.update_traces(width=0.5)
  st.plotly_chart(fig2)
  residence = df1['Location'].value_counts()
  top10_employee_location = residence[:10]
  fig3 = px.bar(y=top10_employee_location.values, 
              x=top10_employee_location.index, 
              color = top10_employee_location.index,
              color_discrete_sequence=px.colors.sequential.deep,
              text=top10_employee_location.values,
              title= 'Top 10 Location of job',
              template= 'plotly_dark')
  fig3.update_layout(height=500,width=500,
      xaxis_title="Location of job",
      yaxis_title="count",
      font = dict(size=17,family="Franklin Gothic"))
  st.plotly_chart(fig3)
    
  type_grouped = df1['Seniority level'].value_counts()
  #e_type = ['Full-Time','Part-Time','Contract','Freelance']
  e_type =dict(df1['Seniority level'].value_counts()).keys()
  fig4 = px.bar(x = e_type, y = type_grouped.values, 
        color = type_grouped.index, 
        color_discrete_sequence=px.colors.sequential.dense,
        template = 'plotly_dark',
        text = type_grouped.values, title = 'Seniority level Distribution')
  fig4.update_layout(height=500,width=500,
      xaxis_title="Seniority level",
      yaxis_title="count",
      font = dict(size=17,family="Franklin Gothic"))
  fig4.update_traces(width=0.5)
  st.plotly_chart(fig4)
  return