You are on page 1of 3

4/2/24, 8:13 PM HollywoodMovies2011

In [1]: import numpy as np

In [2]: import pandas as pd

C:\Users\Administrator\anaconda3\Lib\site-packages\pandas\core\arrays\masked.py:60: U
serWarning: Pandas requires version '1.3.6' or newer of 'bottleneck' (version '1.3.5'
currently installed).
from pandas.core import (

In [3]: import matplotlib.pyplot as plt

In [4]: hwood = pd.read_csv("HollywoodMovies2011.csv")

In [5]: hwood.describe()

Out[5]: RottenTomatoes AudienceScore TheatersOpenWeek BOAverageOpenWeek DomesticGross Fo

count 134.000000 135.000000 120.000000 120.000000 134.000000

mean 53.194030 61.600000 2828.475000 8338.825000 63.222761

std 26.984673 17.033856 932.702579 10284.468976 69.417994

min 4.000000 24.000000 3.000000 1513.000000 0.020000

25% 29.250000 49.500000 2550.000000 3778.750000 19.032500

50% 53.500000 61.000000 2995.000000 5685.500000 37.355000

75% 78.000000 76.500000 3400.500000 8923.000000 80.457500

max 97.000000 93.000000 4375.000000 93230.000000 381.010000 9

In [6]: hwood['Profitability'].describe()

count 134.000000
Out[6]:
mean 3.314521
std 6.616088
min 0.000000
25% 1.064754
50% 2.198864
75% 3.667050
max 64.672667
Name: Profitability, dtype: float64

In [7]: hwood.columns

Index(['Movie', 'LeadStudio', 'RottenTomatoes', 'AudienceScore', 'Story',


Out[7]:
'Genre', 'TheatersOpenWeek', 'BOAverageOpenWeek', 'DomesticGross',
'ForeignGross', 'WorldGross', 'Budget', 'Profitability',
'OpeningWeekend'],
dtype='object')

In [11]: hwood.boxplot(column=['Profitability'])

localhost:8889/nbconvert/html/HollywoodMovies2011.ipynb?download=false 1/3
4/2/24, 8:13 PM HollywoodMovies2011

plt.show()

In [12]: Q1 = hwood['Profitability'].quantile(0.25)
Q3 = hwood['Profitability'].quantile(0.75)
IQR = Q3 - Q1
up = Q3 + (1.5 * IQR)
low = Q1-(1.5 * IQR)

In [15]: hwood.Profitability[hwood.Profitability > up]

0 64.672667
Out[15]:
1 40.379400
2 10.809800
3 10.624888
4 8.873292
5 8.186882
6 7.972960
Name: Profitability, dtype: float64

In [24]: fwood = hwood[hwood['Profitability'] > up]


fwood

localhost:8889/nbconvert/html/HollywoodMovies2011.ipynb?download=false 2/3
4/2/24, 8:13 PM HollywoodMovies2011

Out[24]: Movie LeadStudio RottenTomatoes AudienceScore Story Genre TheatersOpenWeek

Monster
0 Insidious Sony 67.0 65.0 Horror 2408.0
Force

Paranormal Monster
1 Independent 68.0 58.0 Horror 3321.0
Activity 3 Force

2 Bad Teacher Independent 44.0 38.0 Comedy Comedy 3049.0

Harry
Potter and
3 the Deathly Warner Bros 96.0 92.0 Rivalry Fantasy 4375.0
Hallows
Part 2

Relativity
4 Bridesmaids 90.0 77.0 Rivalry Comedy 2918.0
Media

Midnight in
5 Sony 93.0 84.0 Love Romance 944.0
Paris

DreamWorks
6 The Help 75.0 91.0 Maturation Drama 2534.0
Pictures

In [17]: boxplot = hwood.boxplot(column=['Profitability' ], by = ['Genre'])


plt.show()

In [ ]:

localhost:8889/nbconvert/html/HollywoodMovies2011.ipynb?download=false 3/3

You might also like