-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfandango_scores.py
131 lines (115 loc) · 4.16 KB
/
fandango_scores.py
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
import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv('donnees/fandango_scores.csv', index_col = 0)
print(data.columns)
norm_review = data[['RT_user_norm', 'Metacritic_user_nom', 'IMDB_norm', 'Fandango_Ratingvalue', 'Fandango_Stars']]
print(norm_review.head(5))
plt.figure()
plt.subplot(111)
labels = ['RT_user_norm', 'Metacritic_user_nom', 'IMDB_norm', 'Fandango_Ratingvalue', 'Fandango_Stars']
plt.bar(labels, norm_review.loc['Avengers: Age of Ultron (2015)'][labels].values, width=.5)
plt.xticks(labels, rotation=90)
plt.tight_layout(h_pad=3.0)
plt.savefig("img/fandango1.png", format="png")
plt.show(block=False)
plt.figure()
plt.subplot(111)
plt.bar(labels, norm_review.loc['Avengers: Age of Ultron (2015)'][labels].values, width=.5)
plt.xticks(labels, rotation=90)
plt.xlabel('Source de notation')
plt.ylabel('Note moyenne')
plt.title('Moyenne des notes utilisateurs pour le film Avengers: Age of Ultron (2015)')
plt.subplots_adjust(bottom=0.5)
plt.savefig("img/fandango2.png", format="png")
plt.show(block=False)
plt.figure(figsize=[10,5])
plt.subplot(111)
plt.barh(labels, norm_review.loc['Avengers: Age of Ultron (2015)'][labels].values, height=.5)
plt.yticks(labels)
plt.ylabel('Source de notes')
plt.xlabel('Note moyenne')
plt.title('Note moyenne utilisateurs pour le film Avengers: Age of Ultron (2015)')
plt.subplots_adjust(left=0.2)
plt.savefig("img/fandango3.png", format="png")
plt.show(block=False)
plt.figure()
plt.subplot(111)
plt.scatter(norm_review['Fandango_Ratingvalue'], norm_review['RT_user_norm'])
plt.ylabel('RT_user_norm')
plt.xlabel('Fandango_Ratingvalue')
plt.savefig("img/fandango4.png", format="png")
plt.show(block=False)
fig = plt.figure(figsize=[10, 5])
axe1 = fig.add_subplot(121)
axe2 = fig.add_subplot(122)
axe1.scatter(norm_review['Fandango_Ratingvalue'], norm_review['RT_user_norm'])
axe1.set_ylabel('Rotten Tomatoes')
axe1.set_xlabel('Fandango')
axe2.scatter(norm_review['RT_user_norm'], norm_review['Fandango_Ratingvalue'])
axe2.set_xlabel('Rotten Tomatoes')
axe2.set_ylabel('Fandango')
plt.savefig("img/fandango5.png", format="png")
plt.show(block=False)
fig = plt.figure(figsize=[15, 5])
axe1 = fig.add_subplot(131)
axe2 = fig.add_subplot(132)
axe3 = fig.add_subplot(133)
axe1.scatter(norm_review['Fandango_Ratingvalue'], norm_review['RT_user_norm'])
axe1.set_xlabel('Fandango')
axe1.set_ylabel('Rotten Tomatoes')
axe1.set_xlim(0, 5)
axe1.set_ylim(0, 5)
axe2.scatter(norm_review['Fandango_Ratingvalue'], norm_review['Metacritic_user_nom'])
axe2.set_xlabel('Fandango')
axe2.set_ylabel('Metacritic')
axe2.set_xlim(0, 5)
axe2.set_ylim(0, 5)
axe3.scatter(norm_review['Fandango_Ratingvalue'], norm_review['IMDB_norm'])
axe3.set_xlabel('Fandango')
axe3.set_ylabel('IMDB')
axe3.set_xlim(0, 5)
axe3.set_ylim(0, 5)
plt.savefig("img/fandango6.png", format="png")
plt.show(block=False)
imdb_distribution = norm_review['IMDB_norm'].value_counts().sort_index()
print(imdb_distribution)
plt.figure(111)
plt.hist(norm_review['Fandango_Ratingvalue'])
plt.xticks(range(0, 5))
plt.savefig("img/fandango7.png", format="png")
plt.show(block=False)
fig = plt.figure(figsize=[10, 10])
axe1 = fig.add_subplot(221)
axe2 = fig.add_subplot(222)
axe3 = fig.add_subplot(223)
axe4 = fig.add_subplot(224)
axe1.hist(norm_review['Fandango_Ratingvalue'], bins=20)
axe1.set_xticks(range(0, 5))
axe2.hist(norm_review['RT_user_norm'], bins=20)
axe2.set_xticks(range(0, 5))
axe3.hist(norm_review['Metacritic_user_nom'], bins=20)
axe3.set_xticks(range(0, 5))
axe4.hist(norm_review['IMDB_norm'], bins=20)
axe4.set_xticks(range(0, 5))
axe1.set_ylim(0, 50)
axe2.set_ylim(0, 50)
axe3.set_ylim(0, 50)
axe4.set_ylim(0, 50)
plt.savefig("img/fandango8.png", format="png")
plt.show(block=False)
fig = plt.figure(figsize=[10, 10])
norm_review.boxplot()
plt.ylim(0,5)
plt.xticks(rotation=90)
plt.tight_layout(h_pad=3.0)
plt.savefig("img/fandango9.png", format="png")
plt.show(block=False)
# Marie
cols = ['RT_user_norm', 'Metacritic_user_nom', 'IMDB_norm', 'Fandango_Ratingvalue']
print(norm_review[cols])
fig = plt.figure(figsize=[10, 10])
plt.boxplot(norm_review[cols])
plt.xticks(ticks=range(1, len(cols)+1), labels=cols, rotation=90)
plt.tight_layout(h_pad=3.0)
plt.savefig("img/fandango9-marie.png", format="png")
plt.show()