Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/correlation.py Secret

Created Feb 11, 2021
Embed
What would you like to do?
import pandas as pd
movies = pd.read_csv("MoviesOnStreamingPlatforms_updated.csv")
movies['Rotten Tomatoes'] = movies["Rotten Tomatoes"].str.replace("%", "").astype(float)
movies.drop("Type", inplace=True, axis=1)
correlations = movies.corr(method='pearson')
# Correlation Between All The Features
print(correlations)
# Correlation Between A Particular column "Year"
print(correlations["Year"])
# Visualizing Correlation
import seaborn as sns
import matplotlib.pyplot as plt
sns.heatmap(correlations)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment