Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created February 11, 2021 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/fc9ad0e739ec342d8aa19accb3254ff4 to your computer and use it in GitHub Desktop.
Save amankharwal/fc9ad0e739ec342d8aa19accb3254ff4 to your computer and use it in GitHub Desktop.
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