本文介绍: 从票房角度来看:Harry Potter and the Deathly Hallows Part 2 、Transformers: Dark of the Moon、The Twilight Saga: Breaking Dawn Part 1、The Hangover Part II、Pirates of the Caribbean: On Stranger Tides、Fast Five共6部电影不仅是首映票房还是总票房都异常高于其他电影。2.如果有,哪些电影被认为是优异表现的异常值,请解释。

商务与经济统计案例分析:3-3亚太地区的商学院

要求

1.四个变量中每个变量的描述统计量,接着对每个描述统计量得出关于电影业的情况进行讨论
2.如果有,哪些电影被认为是优异表现的异常值,请解释。
3.列出总票房收入与每一个其他变量之间关系的描述统计量,请解释。

Python实现

1.四个变量中每个变量的描述统计量,接着每个描述统计量得出的关于电影业的情况进行讨论。

import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

data = pd.read_csv('F:DataAnalysisStatisticForBusinessAndEconomicsMovie\2011Movies.csv')
data['Number of Theaters']=data['Number of Theaters'].str.replace(",","").astype('int64')

data.describe()

在这里插入图片描述
相关描述性统计的分析可查看:2-2电影业

2.如果有,哪些电影被认为是优异表现的异常值,请解释。

下面是以四分位数的方式查找异常优秀的电影:

首先从票房角度:

#首映票房
Q1=data['Opening Gross Sales ($millions)'].quantile(q=0.25)#计算下四分位数
Q3=data['Opening Gross Sales ($millions)'].quantile(q=0.75)#计算上四分位数

#基于1.5倍的四分位数差计算上下限对应的值
up_limit=Q3+1.5*(Q3-Q1) #上限值
low_limit=Q1-1.5*(Q3-Q1) #下限值
Value_error=data[(data['Opening Gross Sales ($millions)']>up_limit)]
Value_error

在这里插入图片描述

#总票房
Q1=data['Total Gross Sales ($millions)'].quantile(q=0.25)#计算下四分位数
Q3=data['Total Gross Sales ($millions)'].quantile(q=0.75)#计算上四分位数

#基于1.5倍的四分位数差计算上下限对应的值
up_limit=Q3+1.5*(Q3-Q1) #上限值
low_limit=Q1-1.5*(Q3-Q1) #下限值
Value_error=data[(data['Total Gross Sales ($millions)']>up_limit)]
Value_error

在这里插入图片描述
从票房角度来看:Harry Potter and the Deathly Hallows Part 2 、Transformers: Dark of the Moon、The Twilight Saga: Breaking Dawn Part 1、The Hangover Part II、Pirates of the Caribbean: On Stranger Tides、Fast Five共6部电影不仅是首映票房还是总票房都异常高于其他电影。

Q1=data['Weeks in Release'].quantile(q=0.25)#计算下四分位数
Q3=data['Weeks in Release'].quantile(q=0.75)#计算上四分位数

#基于1.5倍的四分位数差计算上下限对应的值
up_limit=Q3+1.5*(Q3-Q1) #上限值
low_limit=Q1-1.5*(Q3-Q1) #下限值
Value_error=data[(data['Weeks in Release']>up_limit)]
Value_error

3.列出总票房收入与每一个其他变量之间关系的描述统计量,请解释。

X = np.stack((data['Total Gross Sales ($millions)'], data['Opening Gross Sales ($millions)'],data['Weeks in Release'],data['Number of Theaters']), axis=0)# 每一行作为一个变量
np.corrcoef(X)

在这里插入图片描述
通过计算皮尔逊相关系数可知,总票房数与首映票房数呈强正相关,其次与电影剧院数也呈正相关,与放映周数成弱正相关。这个数据刚好也验证了2-2案例-电影业中得到的结论。

原文地址:https://blog.csdn.net/qq_33240671/article/details/134864193

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。

如若转载,请注明出处:http://www.7code.cn/show_51095.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注