<jupyter_start><jupyter_text>Exploratory Data Analysis of James Bond Movies  Importing the Libraries<jupyter_code>import pandas as pd
pd.options.mode.chained_assignment = None
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
import plotly.express as px
import os

sns.set_style('darkgrid')
matplotlib.rcParams['font.size']=14
matplotlib.rcParams['figure.figsize']=(9,5)
matplotlib.rcParams['figure.facecolor']='#00000000'<jupyter_output><empty_output><jupyter_text>Reading in the Data<jupyter_code>raw_bond_df = pd.read_csv('csv/bond_data.csv')
raw_bond_df.head()
raw_bond_df.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 24 entries, 0 to 23
Data columns (total 27 columns):
 #   Column             Non-Null Count  Dtype  
---  ------             --------------  -----  
 0   Year               24 non-null     int64  
 1   Movie              24 non-null     object 
 2   Bond               24 non-null     object 
 3   Director           24 non-null     object 
 4   Composer           24 non-null     object 
 5   Writer             24 non-null     object 
 6   Cinematographer    24 non-null     object 
 7   Depicted_Film_Loc  24 non-null     object 
 8   Shooting_Loc       24 non-null     object 
 9   Bond_Car_MFG       24 non-null     object 
 10  Bond_Girl_Nat      24 non-null     object 
 11  US_Gross           24 non-null     int64  
 12  US_Adj             24 non-null     int64  
 13  World_Gross        24 non-null     int64  
 14  World_Adj          24 non-null     int64  
 15  Budget             24 non-null     int64  
 16  Budget_Adj         24 non-nu[...]<jupyter_text>Create a Reference Copy<jupyter_code>bond_df = raw_bond_df.copy()<jupyter_output><empty_output><jupyter_text>Who Was 007?<jupyter_code>the_bonds = bond_df.groupby('Bond').Movie.count()
plt.figure(figsize=(12,6))
plt.xticks(rotation=75)
plt.title('The Bonds')
g = sns.barplot(x=the_bonds.index, y=the_bonds, palette='Set3')
g.set(xlabel = "Actor", ylabel="Number of Movies");<jupyter_output><empty_output><jupyter_text>Who Directed the most Films?<jupyter_code>the_directors = bond_df.groupby('Director').Movie.count()
plt.figure(figsize=(12,6))
plt.xticks(rotation=75)
plt.title('The Directors')
g = sns.barplot(x=the_directors.index, y=the_directors, palette='Set3')
g.set(xlabel = "Director", ylabel="Number of Movies");<jupyter_output><empty_output><jupyter_text>Which Films Rated Highest?<jupyter_code>ratings = bond_df[['Movie', 'Bond', 'Year', 'Avg_User_IMDB', 'Avg_User_Rtn_Tom', 'Budget_Adj', 'World_Adj']]
ratings.World_Adj = ratings.World_Adj / 1000
ratings.Budget_Adj = ratings.Budget_Adj / 1000
ratings = ratings.rename(columns={'World_Adj':'World_Adj_Thousands', 'Budget_Adj':'Budget_Adj_Thousands'})
ratings.head()<jupyter_output><empty_output><jupyter_text>Does Budget Affect the Rating?<jupyter_code>plt.scatter('Avg_User_IMDB', 'Budget_Adj_Thousands', data=ratings, marker='>', label='IMDb')
plt.scatter('Avg_User_Rtn_Tom', 'Budget_Adj_Thousands', data=ratings, marker='o', label='Rotten Tomatoes')

plt.xlabel('Ratings')
plt.ylabel('Movie Budget')
plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.)

plt.title('Ratings vs. Budget')
plt.show();<jupyter_output><empty_output><jupyter_text>Does the Actor Affect Earnings or IMDb Ratings?<jupyter_code>g = sns.scatterplot(data=ratings, x='Avg_User_IMDB', y='World_Adj_Thousands', hue='Bond', marker="^")
plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.)
g.set(xlabel = "Rating", ylabel="Gross");<jupyter_output><empty_output><jupyter_text>Or the Budget?<jupyter_code>g = sns.scatterplot(data=ratings, x='Budget_Adj_Thousands', y='World_Adj_Thousands', hue='Bond', marker="o")
plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.)
g.set(xlabel = "Budget", ylabel="Gross");<jupyter_output><empty_output><jupyter_text>Which Movies Earned the Most?<jupyter_code>ratings = ratings.sort_values(by='World_Adj_Thousands', ascending=False)
g = sns.catplot(data=ratings, x='Movie', y='World_Adj_Thousands', kind='bar', height=10)
#plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.)
plt.xticks(rotation=75)
g.set(xlabel = "Budget", ylabel="Gross");<jupyter_output><empty_output><jupyter_text>Does This Reflect Their Initial Budget?<jupyter_code>g = sns.barplot(data=ratings, x='Budget_Adj_Thousands', y='World_Adj_Thousands', palette="Blues_d")
#plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.)
plt.xticks(rotation=75)
g.set(xlabel = "Budget", ylabel="Gross");<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13884690131721011, 'fraction_numerical': 0.030878859857482184, 'mean_word_length': 4.915708812260537, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 46, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '400879', 'license': 'MIT', 'n_tokens_mistral': 1911, 'n_tokens_neox': 1727, 'n_words': 305, 'path': 'BondEDA.ipynb', 'repo_name': 'caly-pso/exploring_media', 'size': '4631'}