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

How the seaborn package is used in python projects

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how to use the seaborn package in the python project". Many people will encounter this dilemma in the operation of the actual case, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The Seaborn package is an enhanced version of mapplotlib and can only be used after installing mapplotlib.

All graphics are displayed by plt.show (), or you can create a canvas using the following method

Picture, ax=PLT. Submissions () # a canvas

Figure, (ax1,ax2) = PLT. Regional plot (ncols=2) # 2 canvas 1) single feature statistical graph countplot

The Sn.countplot (train.mnth) # discrete feature can be used to describe the number of occurrences of sample points.

2) single feature statistical graph distplot

Sn . Distplot (train. Cnt . Values, bin=50,kde=True) # can use continuous features, bin=50 is divided into 50 columns, and kde=True displays nuclear density lines. If the tail of the graph is special and may be a singularity (outlier, noise point), consider removing it.

3) double-characteristic violin picture

SN . Violin Plot (data=train ['yr', 'CNT']], Xerox' yr', yearly 'CNT') # shows the data distribution and its probability density The thick black bar in the middle represents the quartile range, the thin black line extending from it represents the 95% confidence interval, and the white point is the median.

4) double characteristic box diagram

Sn . Box chart (data=train,x=' yr', box 'CNT') #, also known as box chart, box chart or box chart, is a statistical chart used to display a set of discrete information of data. It displays outliers, maximum, upper quartile, median, lower quartile, minimum, and outlier from top to bottom (sometimes none, if any, pay special attention).

5) double feature bar graph

Figure, (ax1,ax2) = PLT. Regional plot (ncols=2) # one canvas, two axes

Sn . Barplot (data=train,x=' holiday', yearly 'CNT', hue=' weathersit', ax=ax1) # hue=' weathersit', distinguished by weathersit

Sn . Barplot (data=train,x=' working day', yearly 'CNT', hue=' season', ax=ax2) # hue=' season', distinguished by season

6) double characteristic line chart

Figure, ax=plt. Feeder plot ()

Sn. Point plot (data=train ['dayofyear', 'cnt', 'yr'], x='dayofyear', y='cnt', hue='yr', ax=ax)

# hue='yr 'refers to the year of honor. Hue refers to color.

Ax. Set (title=' dayly distribution of counts')

PLT. Show ()

7) Relational thermal map

CorrMatt=train [['temp', 'atemp', 'hum', 'windspeed', 'cnt']. Corr ()

Mask=np.array (corrMatt)

Mask [NP. Tril _ indexs _ from (mask)] = False

Sn.heatmap (corrMatt,mask=mask

Vmax=1, squared = true, cannot = true)

PLT. Show ()

8) double characteristic scatter plot

Sn. Scatter plot (x=train). GrLivArea,y=train . SalePrice)

PLT. Title ('looking for outliers') # graphic title

PLT. Show ()

This is the end of the content of "how to use the seaborn package in the python project". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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