自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Seaborn 常用的 10 種數(shù)據(jù)分析圖表

大數(shù)據(jù) 數(shù)據(jù)可視化
Seaborn內(nèi)置了十幾個(gè)示例數(shù)據(jù)集,通過load_dataset函數(shù)可以調(diào)用。其中包括常見的泰坦尼克、鳶尾花等經(jīng)典數(shù)據(jù)集。

內(nèi)置示例數(shù)據(jù)集

seaborn內(nèi)置了十幾個(gè)示例數(shù)據(jù)集,通過load_dataset函數(shù)可以調(diào)用。

其中包括常見的泰坦尼克、鳶尾花等經(jīng)典數(shù)據(jù)集。

  1. # 查看數(shù)據(jù)集種類 
  2. import seaborn as sns 
  3. sns.get_dataset_names() 

seaborn 常用的 10 種數(shù)據(jù)分析圖表

  1. import seaborn as sns 
  2. # 導(dǎo)出鳶尾花數(shù)據(jù)集 
  3. data = sns.load_dataset('iris') 
  4. data.head() 

seaborn 常用的 10 種數(shù)據(jù)分析圖表

1. 散點(diǎn)圖

函數(shù)sns.scatterplot

  1. import seaborn as sns 
  2. sns.set() 
  3. import matplotlib.pyplot as plt 
  4. %matplotlib inline 
  5. # 小費(fèi)數(shù)據(jù)集 
  6. tips = sns.load_dataset('tips') 
  7. ax = sns.scatterplot(x='total_bill',y='tip',data=tips
  8. plt.show() 

seaborn 常用的 10 種數(shù)據(jù)分析圖表

2. 條形圖

函數(shù)sns.barplot

顯示數(shù)據(jù)平均值和置信區(qū)間

  1. import seaborn as sns 
  2. sns.set() 
  3. import matplotlib.pyplot as plt 
  4. %matplotlib inline 
  5. # 小費(fèi)數(shù)據(jù)集 
  6. tips = sns.load_dataset("tips") 
  7. ax = sns.barplot(x="day"y="total_bill"data=tips
  8. plt.show() 

seaborn 常用的 10 種數(shù)據(jù)分析圖表

3. 線型圖

函數(shù)sns.lineplot

繪制折線圖和置信區(qū)間

  1. import seaborn as sns 
  2. sns.set() 
  3. import matplotlib.pyplot as plt 
  4. %matplotlib inline 
  5. fmri = sns.load_dataset("fmri") 
  6. ax = sns.lineplot(x="timepoint"y="signal"data=fmri
  7. plt.show() 

seaborn 常用的 10 種數(shù)據(jù)分析圖表

4. 箱線圖

函數(shù)seaborn.boxplot

  1. import seaborn as sns 
  2. sns.set() 
  3. import matplotlib.pyplot as plt 
  4. %matplotlib inline 
  5. tips = sns.load_dataset("tips") 
  6. ax = sns.boxplot(x="day"y="total_bill"data=tips
  7. plt.show() 

seaborn 常用的 10 種數(shù)據(jù)分析圖表

5. 直方圖

函數(shù)seaborn.distplot

  1. import seaborn as sns 
  2. import numpy as np 
  3. sns.set() 
  4. import matplotlib.pyplot as plt 
  5. %matplotlib inline 
  6. np.random.seed(0) 
  7. x = np.random.randn(1000) 
  8. ax = sns.distplot(x) 
  9. plt.show() 

seaborn 常用的 10 種數(shù)據(jù)分析圖表

6. 熱力圖

函數(shù)seaborn.heatmap

  1. import numpy as np 
  2. np.random.seed(0) 
  3. import seaborn as sns  
  4. sns.set() 
  5. import matplotlib.pyplot as plt 
  6. %matplotlib inline 
  7. uniform_data = np.random.rand(10, 12) 
  8. ax = sns.heatmap(uniform_data) 
  9. plt.show() 

seaborn 常用的 10 種數(shù)據(jù)分析圖表

7. 散點(diǎn)圖矩陣

函數(shù)sns.pairplot

  1. import seaborn as sns 
  2. sns.set() 
  3. import matplotlib.pyplot as plt 
  4. %matplotlib inline 
  5. iris = sns.load_dataset("iris") 
  6. ax = sns.pairplot(iris) 
  7. plt.show() 

seaborn 常用的 10 種數(shù)據(jù)分析圖表

8. 分類散點(diǎn)圖

函數(shù)seaborn.catplot

  1. import seaborn as sns 
  2. sns.set() 
  3. import matplotlib.pyplot as plt 
  4. %matplotlib inline 
  5. exercise = sns.load_dataset("exercise") 
  6. ax = sns.catplot(x="time"y="pulse"hue="kind"data=exercise)\ 
  7. plt.show() 

seaborn 常用的 10 種數(shù)據(jù)分析圖表

9. 計(jì)數(shù)條形圖

函數(shù)seaborn.countplot

  1. import seaborn as sns 
  2. sns.set() 
  3. import matplotlib.pyplot as plt 
  4. %matplotlib inline 
  5. titanic = sns.load_dataset("titanic") 
  6. ax = sns.countplot(x="class"data=titanic
  7. plt.show() 

seaborn 常用的 10 種數(shù)據(jù)分析圖表

10. 回歸圖

函數(shù) seaborn.lmplot

繪制散點(diǎn)及回歸圖

  1. import seaborn as sns 
  2. sns.set() 
  3. import matplotlib.pyplot as plt 
  4. %matplotlib inline 
  5. tips = sns.load_dataset("tips") 
  6. ax = sns.lmplot(x="total_bill"y="tip"data=tips
  7.  
  8. plt.show() 

seaborn 常用的 10 種數(shù)據(jù)分析圖表

責(zé)任編輯:趙寧寧 來源: 今日頭條
相關(guān)推薦

2020-08-10 06:16:26

seaborn數(shù)據(jù)分析圖表

2020-12-22 15:33:42

數(shù)據(jù)分析技術(shù)IT

2017-08-01 16:42:09

數(shù)據(jù)分析互聯(lián)網(wǎng)

2020-09-08 12:48:19

數(shù)據(jù)分析圖表互聯(lián)網(wǎng)

2019-05-06 09:27:13

數(shù)據(jù)分析大數(shù)據(jù)開發(fā)數(shù)據(jù)

2020-03-23 09:53:26

大數(shù)據(jù)IT技術(shù)

2018-08-30 14:20:54

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

2022-09-07 15:47:21

數(shù)據(jù)分析對比分析大數(shù)據(jù)

2022-08-26 16:21:47

數(shù)據(jù)分析工具運(yùn)營

2017-06-28 14:54:17

大數(shù)據(jù)數(shù)據(jù)分析

2020-12-07 05:51:49

數(shù)據(jù)分析數(shù)據(jù)可視化數(shù)據(jù)科學(xué)

2023-08-01 16:01:59

可視化Seaborn

2024-12-31 12:09:31

2024-01-26 13:23:22

數(shù)據(jù)分析指標(biāo)監(jiān)控型

2020-12-08 10:27:04

數(shù)據(jù)分析技術(shù)IT

2023-11-26 17:47:00

數(shù)據(jù)分析

2019-07-25 14:23:36

2015-10-30 13:57:20

烹飪數(shù)據(jù)分析

2017-01-11 16:54:34

數(shù)據(jù)分析數(shù)據(jù)準(zhǔn)備數(shù)據(jù)虛擬化

2021-02-28 12:47:27

數(shù)據(jù)分析科學(xué)技術(shù)
點(diǎn)贊
收藏

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