99999久久久久久亚洲,欧美人与禽猛交狂配,高清日韩av在线影院,一个人在线高清免费观看,啦啦啦在线视频免费观看www

熱線電話:13121318867

登錄
首頁精彩閱讀seaborn 常用的 10 種數(shù)據(jù)分析圖表
seaborn 常用的 10 種數(shù)據(jù)分析圖表
2020-04-28
收藏
<a href='/map/seaborn/' style='color:#000;font-size:inherit;'>seaborn</a> 常用的 10 種數(shù)據(jù)分析圖表


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


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


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


# 查看數(shù)據(jù)集種類
import seaborn as sns
sns.get_dataset_names()
<a href='/map/seaborn/' style='color:#000;font-size:inherit;'>seaborn</a> 常用的 10 種數(shù)據(jù)分析圖表
import seaborn as sns
# 導(dǎo)出鳶尾花數(shù)據(jù)集
data = sns.load_dataset('iris')
data.head()

<a href='/map/seaborn/' style='color:#000;font-size:inherit;'>seaborn</a> 常用的 10 種數(shù)據(jù)分析圖表


1、散點(diǎn)圖


函數(shù)sns.scatterplot


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

<a href='/map/seaborn/' style='color:#000;font-size:inherit;'>seaborn</a> 常用的 10 種數(shù)據(jù)分析圖表


2、條形圖


函數(shù)sns.barplot


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


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

<a href='/map/seaborn/' style='color:#000;font-size:inherit;'>seaborn</a> 常用的 10 種數(shù)據(jù)分析圖表


3、線型圖


函數(shù)sns.lineplot


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


import seaborn as sns
sns.set()
import matplotlib.pyplot as plt
%matplotlib inline
fmri = sns.load_dataset("fmri")
ax = sns.lineplot(x="timepoint", y="signal", data=fmri)
plt.show()
<a href='/map/seaborn/' style='color:#000;font-size:inherit;'>seaborn</a> 常用的 10 種數(shù)據(jù)分析圖表


4、箱線圖


函數(shù)seaborn.boxplot


import seaborn as sns
sns.set()
import matplotlib.pyplot as plt
%matplotlib inline
tips = sns.load_dataset("tips")
ax = sns.boxplot(x="day", y="total_bill", data=tips)
plt.show()
<a href='/map/seaborn/' style='color:#000;font-size:inherit;'>seaborn</a> 常用的 10 種數(shù)據(jù)分析圖表


5、直方圖


函數(shù)seaborn.distplot


import seaborn as sns
import numpy as np
sns.set()
import matplotlib.pyplot as plt
%matplotlib inline
np.random.seed(0)
x = np.random.randn(1000)
ax = sns.distplot(x)
plt.show()
<a href='/map/seaborn/' style='color:#000;font-size:inherit;'>seaborn</a> 常用的 10 種數(shù)據(jù)分析圖表


6、熱力圖


函數(shù)seaborn.heatmap


import numpy as np
np.random.seed(0)
import seaborn as sns 
sns.set()
import matplotlib.pyplot as plt
%matplotlib inline
uniform_data = np.random.rand(10, 12)
ax = sns.heatmap(uniform_data)
plt.show()
<a href='/map/seaborn/' style='color:#000;font-size:inherit;'>seaborn</a> 常用的 10 種數(shù)據(jù)分析圖表


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


函數(shù)sns.pairplot


import seaborn as sns
sns.set()
import matplotlib.pyplot as plt
%matplotlib inline
iris = sns.load_dataset("iris")
ax = sns.pairplot(iris)
plt.show()

<a href='/map/seaborn/' style='color:#000;font-size:inherit;'>seaborn</a> 常用的 10 種數(shù)據(jù)分析圖表


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


函數(shù)seaborn.catplot


import seaborn as sns
sns.set()
import matplotlib.pyplot as plt
%matplotlib inline
exercise = sns.load_dataset("exercise")
ax = sns.catplot(x="time", y="pulse", hue="kind", data=exercise)\
plt.show()
<a href='/map/seaborn/' style='color:#000;font-size:inherit;'>seaborn</a> 常用的 10 種數(shù)據(jù)分析圖表


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


函數(shù)seaborn.countplot


import seaborn as sns
sns.set()
import matplotlib.pyplot as plt
%matplotlib inline
titanic = sns.load_dataset("titanic")
ax = sns.countplot(x="class", data=titanic)
plt.show()

<a href='/map/seaborn/' style='color:#000;font-size:inherit;'>seaborn</a> 常用的 10 種數(shù)據(jù)分析圖表


10、回歸圖


函數(shù) seaborn.lmplot


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


import seaborn as sns
sns.set()
import matplotlib.pyplot as plt
%matplotlib inline
tips = sns.load_dataset("tips")
ax = sns.lmplot(x="total_bill", y="tip", data=tips)

plt.show()
<a href='/map/seaborn/' style='color:#000;font-size:inherit;'>seaborn</a> 常用的 10 種數(shù)據(jù)分析圖表

數(shù)據(jù)分析咨詢請(qǐng)掃描二維碼

若不方便掃碼,搜微信號(hào):CDAshujufenxi

數(shù)據(jù)分析師資訊
更多

OK
客服在線
立即咨詢
客服在線
立即咨詢
') } function initGt() { var handler = function (captchaObj) { captchaObj.appendTo('#captcha'); captchaObj.onReady(function () { $("#wait").hide(); }).onSuccess(function(){ $('.getcheckcode').removeClass('dis'); $('.getcheckcode').trigger('click'); }); window.captchaObj = captchaObj; }; $('#captcha').show(); $.ajax({ url: "/login/gtstart?t=" + (new Date()).getTime(), // 加隨機(jī)數(shù)防止緩存 type: "get", dataType: "json", success: function (data) { $('#text').hide(); $('#wait').show(); // 調(diào)用 initGeetest 進(jìn)行初始化 // 參數(shù)1:配置參數(shù) // 參數(shù)2:回調(diào),回調(diào)的第一個(gè)參數(shù)驗(yàn)證碼對(duì)象,之后可以使用它調(diào)用相應(yīng)的接口 initGeetest({ // 以下 4 個(gè)配置參數(shù)為必須,不能缺少 gt: data.gt, challenge: data.challenge, offline: !data.success, // 表示用戶后臺(tái)檢測(cè)極驗(yàn)服務(wù)器是否宕機(jī) new_captcha: data.new_captcha, // 用于宕機(jī)時(shí)表示是新驗(yàn)證碼的宕機(jī) product: "float", // 產(chǎn)品形式,包括:float,popup width: "280px", https: true // 更多配置參數(shù)說明請(qǐng)參見:http://docs.geetest.com/install/client/web-front/ }, handler); } }); } function codeCutdown() { if(_wait == 0){ //倒計(jì)時(shí)完成 $(".getcheckcode").removeClass('dis').html("重新獲取"); }else{ $(".getcheckcode").addClass('dis').html("重新獲取("+_wait+"s)"); _wait--; setTimeout(function () { codeCutdown(); },1000); } } function inputValidate(ele,telInput) { var oInput = ele; var inputVal = oInput.val(); var oType = ele.attr('data-type'); var oEtag = $('#etag').val(); var oErr = oInput.closest('.form_box').next('.err_txt'); var empTxt = '請(qǐng)輸入'+oInput.attr('placeholder')+'!'; var errTxt = '請(qǐng)輸入正確的'+oInput.attr('placeholder')+'!'; var pattern; if(inputVal==""){ if(!telInput){ errFun(oErr,empTxt); } return false; }else { switch (oType){ case 'login_mobile': pattern = /^1[3456789]\d{9}$/; if(inputVal.length==11) { $.ajax({ url: '/login/checkmobile', type: "post", dataType: "json", data: { mobile: inputVal, etag: oEtag, page_ur: window.location.href, page_referer: document.referrer }, success: function (data) { } }); } break; case 'login_yzm': pattern = /^\d{6}$/; break; } if(oType=='login_mobile'){ } if(!!validateFun(pattern,inputVal)){ errFun(oErr,'') if(telInput){ $('.getcheckcode').removeClass('dis'); } }else { if(!telInput) { errFun(oErr, errTxt); }else { $('.getcheckcode').addClass('dis'); } return false; } } return true; } function errFun(obj,msg) { obj.html(msg); if(msg==''){ $('.login_submit').removeClass('dis'); }else { $('.login_submit').addClass('dis'); } } function validateFun(pat,val) { return pat.test(val); }