-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbar_graph.py
More file actions
36 lines (27 loc) · 793 Bytes
/
bar_graph.py
File metadata and controls
36 lines (27 loc) · 793 Bytes
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
import matplotlib.pyplot as plt
import numpy as np
import csv
from collections import Counter
import pandas as pd
plt.style.use('ggplot')
data = pd.read_csv('datasets/data.csv')
ids = data['Responder_id']
lang_responses = data['LanguagesWorkedWith']
languase_counter = Counter()
for responses in lang_responses:
language_counter.update(responses.split(';'))
languages = []
popularity = []
for item in language_counter.most_common(15):
languages.append(item[0])
popularity.append(item[1])
languages.reverse()
popularity.reverse()
plt.barh(languages, popularity)
plt.ylabel('Popular Languages')
plt.xlabel('Popularity')
plt.title('Languages popularity among th developers')
plt.legend()
plt.xticks(ticks = x_index, labels = ages_x)
plt.tight_layout()
plt.show()