Answers for "how to create correlation heatmap in python"

0

how to create correlation heatmap in python

# import modules
import matplotlib.pyplot as mp
import pandas as pd
import seaborn as sb
  
# import file with data
data = pd.read_csv("C:\Users\Vanshi\Desktop\bestsellers.csv")
  
# prints data that will be plotted
# columns shown here are selected by corr() since
# they are ideal for the plot
print(data.corr())
  
# plotting correlation heatmap
dataplot = sb.heatmap(data.corr(), cmap="YlGnBu", annot=True)
  
# displaying heatmap
mp.show()
Posted by: Guest on January-19-2022

Code answers related to "how to create correlation heatmap in python"

Python Answers by Framework

Browse Popular Code Answers by Language