<jupyter_start><jupyter_text>EDD There are missing values and outliers in _Time_taken_<jupyter_code>sns.boxplot(y="Time_taken", data=df)<jupyter_output><empty_output><jupyter_text>There are outliers in _Collection_<jupyter_code>sns.boxplot(y="Collection", data=df)<jupyter_output><empty_output><jupyter_text>There are outliers in _Marketing expense_<jupyter_code>sns.boxplot(y="Marketing expense", data=df)<jupyter_output><empty_output><jupyter_text>There are outliers in _Trailer_views_<jupyter_code>sns.boxplot(y="Trailer_views", data=df)<jupyter_output><empty_output><jupyter_text>There are outliers in _Twitter_hastags_<jupyter_code>sns.boxplot(y="Twitter_hastags", data=df)<jupyter_output><empty_output><jupyter_text>There are outliers in _Num_multiplex_<jupyter_code>sns.boxplot(y="Num_multiplex", data=df)<jupyter_output><empty_output><jupyter_text>Categorical values<jupyter_code>sns.countplot(y="Start_Tech_Oscar", data=df)
sns.countplot(y="3D_available", data=df)<jupyter_output><empty_output><jupyter_text>_MPAA_film_rating_ is constant<jupyter_code>sns.countplot(y="MPAA_film_rating", data=df)
sns.countplot(y="Genre", data=df)<jupyter_output><empty_output><jupyter_text>Removing outliers<jupyter_code>lv_collection = np.percentile(df.Collection, [5])[0]
uv_collection = np.percentile(df.Collection, [90])[0]
df.Collection[(df.Collection < lv_collection)] = lv_collection
df.Collection[(df.Collection > uv_collection)] = uv_collection
df.Collection.describe()
sns.boxplot(y="Collection", data=df)
uv_marketing_expense = np.percentile(df["Marketing expense"], [87])[0]
uv_marketing_expense
df["Marketing expense"][(df["Marketing expense"] > uv_marketing_expense)] = uv_marketing_expense
sns.boxplot(y="Marketing expense", data=df)
df["Marketing expense"].describe()
lv_trailer_views = np.percentile(df.Trailer_views, [2])[0]
lv_trailer_views
df.Trailer_views[(df.Trailer_views < lv_trailer_views)] = lv_trailer_views
sns.boxplot(y="Trailer_views", data=df)
uv_twitter = np.percentile(df.Twitter_hastags, [99])[0]
df.Twitter_hastags[(df.Twitter_hastags > uv_twitter)] = uv_twitter
sns.boxplot(y="Twitter_hastags", data=df)
uv_num_multiplex = np.percentile(df.Num_multiplex, [99])[0]
df.Num_multiplex[(df.Num_multiplex > uv_num_multiplex)] = uv_num_multiplex
sns.boxplot(y="Num_multiplex", data=df)<jupyter_output><empty_output><jupyter_text>Missing values<jupyter_code>df.info()
df = df.fillna(df.mean())
df.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 506 entries, 0 to 505
Data columns (total 20 columns):
 #   Column               Non-Null Count  Dtype  
---  ------               --------------  -----  
 0   Collection           506 non-null    int64  
 1   Marketing expense    506 non-null    float64
 2   Production expense   506 non-null    float64
 3   Multiplex coverage   506 non-null    float64
 4   Budget               506 non-null    float64
 5   Movie_length         506 non-null    float64
 6   Lead_ Actor_Rating   506 non-null    float64
 7   Lead_Actress_rating  506 non-null    float64
 8   Director_rating      506 non-null    float64
 9   Producer_rating      506 non-null    float64
 10  Critic_rating        506 non-null    float64
 11  Trailer_views        506 non-null    float64
 12  3D_available         506 non-null    object 
 13  Time_taken           506 non-null    float64
 14  Twitter_hastags      506 non-null    float64
 15  Genre                506 non-null    obj[...]<jupyter_text>Constant values<jupyter_code>del df["MPAA_film_rating"]
df.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 506 entries, 0 to 505
Data columns (total 19 columns):
 #   Column               Non-Null Count  Dtype  
---  ------               --------------  -----  
 0   Collection           506 non-null    int64  
 1   Marketing expense    506 non-null    float64
 2   Production expense   506 non-null    float64
 3   Multiplex coverage   506 non-null    float64
 4   Budget               506 non-null    float64
 5   Movie_length         506 non-null    float64
 6   Lead_ Actor_Rating   506 non-null    float64
 7   Lead_Actress_rating  506 non-null    float64
 8   Director_rating      506 non-null    float64
 9   Producer_rating      506 non-null    float64
 10  Critic_rating        506 non-null    float64
 11  Trailer_views        506 non-null    float64
 12  3D_available         506 non-null    object 
 13  Time_taken           506 non-null    float64
 14  Twitter_hastags      506 non-null    float64
 15  Genre                506 non-null    obj[...]<jupyter_text>Transform Data Main character rating<jupyter_code>df["main_character_ratin"] = (df.Lead_Actress_rating + df["Lead_ Actor_Rating"]) / 2
del df["Lead_Actress_rating"]
del df["Lead_ Actor_Rating"]
df.main_character_ratin.describe()<jupyter_output><empty_output><jupyter_text>Dummy Variables<jupyter_code>df = pd.get_dummies(df)
df.describe()
del df["3D_available_NO"]
del df["Genre_Thriller"]
df.describe()<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup