def getTopMoviesPublicRating(request): df = getData() topMovies = df.nlargest(15, ['PublicRating']) br = sns.barplot(y='MovieName', x='PublicRating', data=topMovies) br.set_yticklabels(br.get_yticklabels(), fontsize=7) mediapath = settings.MEDIA_ROOT figure = br.get_figure() figure.savefig(mediapath + "/chart1.png") return render(request, "dashboard/index.html", {"PATH": settings.MEDIA_URL})
def getTopMoviesGross(request): df = getData() topMovies = df.nlargest(15, ['GrossMillions']) gr = sns.barplot(y='MovieName', x='GrossMillions', data=topMovies) gr.set_yticklabels(gr.get_yticklabels(), fontsize=7) mediapath = settings.MEDIA_ROOT figure = gr.get_figure() figure.savefig(mediapath + "/chart1.png") plt.clf() return render(request, "dashboard/index.html", {"PATH": settings.MEDIA_URL})
def getCountMoviesYear(request): df = getData() df = df.loc[df['PublicRating'] > 0] df = df.loc[df['CriticRating'] > 0] gr = sns.countplot(y='Year', data=df) gr.set_yticklabels(gr.get_yticklabels(), fontsize=7) gr.set_title("Number of Movies that were rated by critics and public") mediapath = settings.MEDIA_ROOT figure = gr.get_figure() figure.savefig(mediapath + "/chart1.png") plt.clf() return render(request, "dashboard/index.html", {"PATH": settings.MEDIA_URL})
def getPublicRatingVsCriticRating(request): df = getData() data = df.loc[df['CriticRating'] > -1] data = data.loc[df['PublicRating'] > 0] gr = sns.jointplot(data=data, x='PublicRating', y='CriticRating') mediapath = settings.MEDIA_ROOT gr.savefig(mediapath + "/chart1.png") factlist = [1, 2, 3, 4, 5] plt.clf() return render(request, "dashboard/index.html", { "PATH": settings.MEDIA_URL, "factlist": factlist })
def getRuntimevsGross(request): df = getData() data = df.loc[df.GrossMillions > 0] data = data.loc[data.PublicRating > 0] gr = sns.jointplot(data=data, x='PublicRating', y='Runtime') buf = io.BytesIO() mediapath = settings.MEDIA_ROOT gr.savefig(mediapath + "/chart1.png") plt.clf() factlist = [1, 2, 3, 4, 5] return render(request, "dashboard/index.html", { "PATH": settings.MEDIA_URL, "factlist": factlist })
def getPublicRatingGenre(request): df = getData() df = df.groupby('Genre').mean() df = df.nlargest(10, 'PublicRating') return render(request, "dashboard/index.html", {"PATH": settings.MEDIA_URL})