<jupyter_start><jupyter_text>Visualize Your Plot: Matplotlib   Visualize Your Plot: Matplotlib<jupyter_code>%matplotlib inline
data.plot(kind='scatter', x='rating', y='votes')
data['rating'].plot(kind='hist')<jupyter_output><empty_output><jupyter_text>seaborn: statistical data visualization<jupyter_code>import seaborn as sns
sns.pairplot(data)
sns.lmplot(x='rating', y='votes', data=data)<jupyter_output><empty_output><jupyter_text>Linear Regression [StatsModels - Ordinary Least Square (OSL) Regression]<jupyter_code>import statsmodels.api as sm
results = sm.OLS(data["votes"], data["rating"]).fit()
results.summary()<jupyter_output><empty_output><jupyter_text>Advanced Data Selection using pandas<jupyter_code>data[data['year'] > 1995 ]
data[data['year']==1996]
data[(data['year'] > 1995) & (data['year'] < 2000)]
#if we want to know the top 10 rated movies in a given span of years, we can run: 
data[(data['year'] > 1995) & (data['year'] < 2000)].sort_values(by='rating', ascending=False).head(10)<jupyter_output><empty_output><jupyter_text>Pandas groupby<jupyter_code>data.groupby(data['year'])['rating'].mean()
data.groupby(data['year'])['rating'].min()
data.groupby(data['year'])['rating'].max()
#What was the highest scoring movie in 1996?
data[(data['year'] == 1996)].sort_values(by='rating', ascending=False).head() 
#In what year was the highest rated movie of all time made?
data[data['rating'] == data['rating'].max()]
#What five movies have the most votes ever?
data.sort_values(by='votes', ascending=False).head()
#What year in the 1960s had the highest average movie rating?
data[(data['year'] >= 1960) & (data['year'] <= 1970)].groupby(data['year'])['rating'].mean()
data[data['year'] == 1960].groupby(data['year'])['rating'].mean()<jupyter_output><empty_output><jupyter_text>Cleaning Data<jupyter_code>data['title'].str[:-7]
data['formatted title'] = data['title'].str[:-7] 
data.head(10)
data['title'].str.split('\(').str[0] 
data['title'].str.split('\(').str.get(0)
data.head()
data['title'] = data['title'].str[:-7] 
data.head()
data['length'].str[:-6]
data['length'].str.split().str.get(0)
data['length'].str.split().str.get(0).astype('int') 
data['formatted length'] = data['length'].str.replace(' mins.', ' ' )
data.head()
sns.pairplot(data)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20592076621680452, 'fraction_numerical': 0.026991728341314757, 'mean_word_length': 8.73728813559322, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '288737', 'license': 'MIT', 'n_tokens_mistral': 866, 'n_tokens_neox': 805, 'n_words': 146, 'path': 'Web Apps and Data Analysis.ipynb', 'repo_name': 'Biplob45/Learn-Python', 'size': '2297'}