偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

EDA中常用的九個(gè)可視化圖表介紹和代碼示例

大數(shù)據(jù) 數(shù)據(jù)分析
探索性數(shù)據(jù)分析(EDA)是數(shù)據(jù)科學(xué)家用來(lái)分析和調(diào)查數(shù)據(jù)集并總結(jié)其主要特征的一種方法,通常采用數(shù)據(jù)可視化技術(shù)。我們可以說(shuō)EDA是通過(guò)創(chuàng)建可視化和摘要來(lái)調(diào)查和理解數(shù)據(jù)集的過(guò)程。

探索性數(shù)據(jù)分析(EDA)是數(shù)據(jù)科學(xué)家用來(lái)分析和調(diào)查數(shù)據(jù)集并總結(jié)其主要特征的一種方法,通常采用數(shù)據(jù)可視化技術(shù)。我們可以說(shuō)EDA是通過(guò)創(chuàng)建可視化和摘要來(lái)調(diào)查和理解數(shù)據(jù)集的過(guò)程。EDA是我們?cè)儐?wèn)數(shù)據(jù)問(wèn)題的一種方式,可以找出關(guān)于數(shù)據(jù)的所有信息,并理解它為什么是這樣的(即識(shí)別趨勢(shì)、模式、異常等)。

在這篇文章中我們介紹EDA中常用的9個(gè)圖表,并且針對(duì)每個(gè)圖表給出代碼示例。

1、條形圖/計(jì)數(shù)圖

顯示分類變量的分布??梢暬瘮?shù)據(jù)集中每個(gè)類別的頻率或計(jì)數(shù)。

import seaborn as sns
 import matplotlib.pyplot as plt
 
 
 data = sns.load_dataset('tips')
 sns.countplot(x='day', data=data)
 plt.title('Count of Tips by Day')
 plt.show()

2、箱線圖

顯示數(shù)據(jù)中的平均值、中位數(shù)、分位數(shù)和離群值。比較多個(gè)變量的分布??梢宰R(shí)別擴(kuò)散的數(shù)值變量,檢測(cè)數(shù)據(jù)集中潛在的異常值。

import seaborn as sns
 import matplotlib.pyplot as plt
 
 data = sns.load_dataset('tips')
 sns.boxplot(x='day', y='total_bill', data=data)
 plt.title('Box Plot of Total Bill by Day')
 plt.show()

3、密度圖

作為數(shù)據(jù)科學(xué)家,建議使用密度圖而不是直方圖,因?yàn)槲覀儾聹y(cè)最佳的裝箱數(shù)量是有問(wèn)題的。

密度圖可以可視化連續(xù)變量的分布。識(shí)別數(shù)據(jù)中的峰值、低谷和總體模式。了解分布的形狀并比較多個(gè)變量的分布。

import seaborn as sns
 import matplotlib.pyplot as plt
 
 data = sns.load_dataset('tips')
 sns.kdeplot(data['total_bill'], shade=True)
 plt.title('Density Plot of Total Bill')
 plt.show()

4、散點(diǎn)圖

探索兩個(gè)連續(xù)變量之間的關(guān)系。識(shí)別數(shù)據(jù)中的模式、相關(guān)性或集群。

import seaborn as sns
 import matplotlib.pyplot as plt
 
 data = sns.load_dataset('tips')
 sns.scatterplot(x='total_bill', y='tip', data=data)
 plt.title('Scatter Plot of Total Bill vs. Tip')
 plt.show()

5、線型圖

在時(shí)間序列中顯示趨勢(shì)或模式。表示連續(xù)區(qū)間內(nèi)兩個(gè)連續(xù)變量之間的關(guān)系,還可以比較連續(xù)范圍內(nèi)變量的變化。

import seaborn as sns
 import matplotlib.pyplot as plt
 
 data = sns.load_dataset('tips')
 sns.lineplot(x='total_bill', y='tip', data=data)
 plt.title('Line Plot of Tip Over Total Bill')
 plt.show()

6、熱圖

顯示數(shù)值變量的相關(guān)矩陣。識(shí)別大型數(shù)據(jù)集中的模式和關(guān)系。

import seaborn as sns
 import matplotlib.pyplot as plt
 
 data = sns.load_dataset('tips')
 correlation_matrix = data.corr()
 sns.heatmap(correlation_matrix, annot=True, cmap='coolwarm')
 plt.title('Correlation Heatmap')
 plt.show()

7、小提琴圖

結(jié)合了箱形圖和核密度圖的特點(diǎn),可以可視化一個(gè)數(shù)值變量在不同類別中的分布。

import seaborn as sns
 import matplotlib.pyplot as plt
 
 data = sns.load_dataset('tips')
 sns.violinplot(x='day', y='total_bill', data=data)
 plt.title('Violin Plot of Total Bill by Day')
 plt.show()

8、子圖

為了進(jìn)行對(duì)比,可以在同一圖中并排比較多個(gè)子圖。

import seaborn as sns
 import matplotlib.pyplot as plt
 
 data = sns.load_dataset('tips')
 
 plt.figure(figsize=(12, 8))
 
 plt.subplot(2, 2, 1)
 sns.scatterplot(x='total_bill', y='tip', data=data)
 plt.title('Scatter Plot of Total Bill vs Tip')
 
 plt.subplot(2, 2, 2)
 sns.boxplot(x='day', y='total_bill', data=data)
 plt.title('Box Plot of Total Bill by Day')
 
 plt.subplot(2, 2, 3)
 sns.barplot(x='day', y='total_bill', data=data)
 plt.title('Bar Plot of Total Bill by Day')
 
 plt.subplot(2, 2, 4)
 sns.histplot(data['total_bill'], kde=True)
 plt.title('Histogram of Total Bill')
 
 plt.tight_layout()
 plt.show()

9、關(guān)系圖

Pairplot在中文中沒(méi)有特定的翻譯,我這里把它稱作關(guān)系圖,因?yàn)樗怯糜诶L制變量之間的關(guān)系,通過(guò)對(duì)多個(gè)變量進(jìn)行可視化來(lái)探索它們之間的相關(guān)性和趨勢(shì)。

import seaborn as sns
 import matplotlib.pyplot as plt
 
 data = sns.load_dataset('tips')
 
 sns.pairplot(data, hue='day')
 plt.suptitle('Pairplot of Numerical Variables by Day', y=1.02)
 plt.show()

總結(jié)

以上就是在EDA中常用的圖表,可以看到seaborn是可以非常好用的工具,它基于matplotlib但是更加美觀,并且需要編寫(xiě)的代碼更少,所以在EDA需要簡(jiǎn)單的出圖的時(shí)候可以優(yōu)先使用它。

責(zé)任編輯:彭凡 來(lái)源: DeepHub IMBA
相關(guān)推薦

2023-10-24 20:38:15

數(shù)據(jù)分析機(jī)器學(xué)習(xí)

2020-07-13 14:35:25

可視化數(shù)據(jù)編程

2015-08-20 10:04:40

可視化

2022-05-30 08:37:34

可視化圖表項(xiàng)目開(kāi)源

2020-03-01 14:01:22

Echarts數(shù)據(jù)可視化圖表

2024-05-22 16:03:49

2022-11-28 15:04:42

數(shù)據(jù)可視化工具

2023-06-11 16:12:14

數(shù)據(jù)可視化圖表類型

2023-08-01 16:01:59

可視化Seaborn

2017-01-10 15:14:34

大數(shù)據(jù)數(shù)據(jù)可視化圖表類型

2021-04-09 10:42:03

數(shù)據(jù)可視化框架大數(shù)據(jù)

2019-06-23 15:44:24

Matplotlib可視化圖表

2017-05-23 09:07:48

可視化圖表視覺(jué)

2022-08-23 12:32:37

Python可視化圖表

2019-12-18 14:40:09

數(shù)據(jù)可視化后端技術(shù)Python

2023-05-18 07:48:01

.NET網(wǎng)絡(luò)編程

2022-07-13 15:54:14

Matplotlib圖表

2019-05-28 11:52:43

可視化圖表數(shù)據(jù)

2021-10-11 08:04:22

Python數(shù)據(jù)行程

2018-09-26 16:15:31

數(shù)據(jù)可視化大數(shù)據(jù)數(shù)據(jù)分析
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)