Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

To get started with python, you need to master the correlation coefficient of drawing heat map and showing it.

2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces you to the introduction of python needs to master the relevant coefficient of drawing heat map display, the content is very detailed, interested friends can refer to, hope to be helpful to you.

The data set used is still the seed data of the three wheat varieties mentioned earlier.

Those who need sample data can leave a message directly.

The data set includes seven indicators of three varieties of wheat seeds, which are

An area B perimeter C compactness LK length WK width A_coef skewness coefficient LKG groin length

The last variable of image.png, target, is the species to which wheat belongs, which is 0meml, respectively.

It would be nice to use python to install anaconda3 directly on your computer for the first time. I have previously recorded a video for introduction, which can be referred to.

The first step is to start jupyter lab (I am using a computer with win10 system)

Win+ shortcut key enter cmd press enter to open the command line window, and then enter jupyter lab on the command line

Press enter key jupyter lab to launch in the default browser

Click python3 under Notebook to create a new window

Image.png

The next step is to enter the command.

Import pandas module to read data import pandas as pd

Df = pd.read_csv ("D://Rstudio_default_working/kaggle/Seed_Data.csv")

Df.head ()

Image.png removes the last column target because df1 = df.drop ('target',axis=1) is not needed to calculate the correlation coefficient

The next step for image.png is to import the seaborn module to draw the heat map of the correlation coefficient.

Https://heartbeat.fritz.ai/seaborn-heatmaps-13-ways-to-customize-correlation-matrix-visualizations-f1c49c816f07 is referenced here.

Import seaborn as sns

Sns.heatmap (df.corr ())

Image.png

Display correlation coefficient

Sns.heatmap (df.corr (), annot=True)

Image.png

The default of correlation analysis here seems to be Pearson correlation analysis.

Change other methods

Image.pngimage.png on the introduction to python need to master the relevant coefficient of drawing heat map display to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report