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

熱線電話:13121318867

登錄
首頁(yè)精彩閱讀pandas數(shù)據(jù)可視化原來(lái)也這么厲害
pandas數(shù)據(jù)可視化原來(lái)也這么厲害
2020-11-26
收藏

作者:小伍哥 

來(lái)源:AI入門(mén)學(xué)習(xí)(公眾號(hào))

python中,常見(jiàn)的數(shù)據(jù)可視化庫(kù)有3個(gè):

matplotlib最常用的庫(kù),可以算作可視化的必備技能庫(kù),比較底層,api多,學(xué)起來(lái)不太容易。

seaborn是建構(gòu)于matplotlib基礎(chǔ)上,能滿(mǎn)足絕大多數(shù)可視化需求,更特殊的需求還是需要學(xué)習(xí)matplotlib。

pyecharts上面的兩個(gè)庫(kù)都是靜態(tài)的可視化庫(kù),而pyecharts有很好的web兼容性,可以做到可視化的動(dòng)態(tài)效果。并且種類(lèi)也比較豐富。比如這個(gè)圖,就非常厲害:畫(huà)圖神器pyecharts-旭日?qǐng)D

Pandas:而今天要講的是pandas的可視化,Pandas主要作為數(shù)據(jù)分析的庫(kù),雖然沒(méi)有上述三個(gè)庫(kù)那個(gè)強(qiáng)大,但是勝在方便,在數(shù)據(jù)分析的過(guò)程中,只要一行代碼就能實(shí)現(xiàn)。并且圖形也非常漂亮。

看案例

pandas 中,有11個(gè)比較常見(jiàn)的圖形可視化,還有幾個(gè)比較進(jìn)階的,我們一個(gè)一個(gè)看看怎么畫(huà)的

import pandas as pdimport numpy  as npdf= pd.DataFrame(np.random.rand(10, 4), columns=['A','B','C','D'])

01、柱狀圖-縱向

df.plot.bar()

stacked=True,畫(huà)堆疊柱狀圖

df.plot.bar(stacked=True)

02、柱狀圖-橫向

df.plot.barh()

同樣,stacked=True,畫(huà)堆疊柱狀圖

df.plot.barh(stacked=True)

03、面積圖

df.plot.area(alpha = 0.9)
df.plot.area(stacked=True,alpha = 0.9)

04、密度圖-kde

df.plot.kde()

05、密度圖-density

df.plot.density()

06、直方圖

換個(gè)數(shù)據(jù)集

df = pd.DataFrame({'A': np.random.randn(1000) + 1, 
                   'B': np.random.randn(1000),  
                   'C': np.random.randn(1000) - 1},  
                  columns=['A', 'B', 'C']) df.plot.hist(bins=200)
df.plot.hist(stacked=True, bins=20)
df= pd.DataFrame(np.random.rand(1000, 4), columns=['A','B','C','D'])df.diff().hist(color='k', alpha=0.7, bins=50)

07、箱盒圖

df= pd.DataFrame(np.random.rand(100, 4), columns=['A','B','C','D'])df.plot.box()

vert=False也可以換成橫向

df.plot.box(vert=False)

08、散點(diǎn)圖

df.plot.scatter(x='A',y='B')

09、蜂巢圖

df = pd.DataFrame(np.random.randn(1000, 2), columns=['a', 'b'])df['b'] = df['b'] + np.arange(1000)df.plot.hexbin(x='a', y='b', gridsize=25)

07、餅圖

series = pd.Series(3 * np.random.rand(4), index=['a', 'b', 'c', 'd'], 
                   name='series')series.plot.pie(figsize=(6, 6))
series.plot.pie(labels=['AA', 'BB', 'CC', 'DD'], colors=['r', 'g', 'b', 'c'],
                autopct='%.2f', fontsize=20, figsize=(6, 6))

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

from pandas.plotting import scatter_matrix
df = pd.DataFrame(np.random.randn(1000, 4), columns=['a', 'b', 'c', 'd'])
scatter_matrix(df, alpha=0.2, figsize=(6, 6), diagonal='kde')


——熱門(mén)課程推薦:

想學(xué)習(xí)PYTHON數(shù)據(jù)分析與金融數(shù)字化轉(zhuǎn)型精英訓(xùn)練營(yíng),您可以點(diǎn)擊>>>“人才轉(zhuǎn)型”了解課程詳情;

想從事業(yè)務(wù)型數(shù)據(jù)分析師,您可以點(diǎn)擊>>>“數(shù)據(jù)分析師”了解課程詳情;

想從事大數(shù)據(jù)分析師,您可以點(diǎn)擊>>>“大數(shù)據(jù)就業(yè)”了解課程詳情;

想成為人工智能工程師,您可以點(diǎn)擊>>>“人工智能就業(yè)”了解課程詳情;

想了解Python數(shù)據(jù)分析,您可以點(diǎn)擊>>>“Python數(shù)據(jù)分析師”了解課程詳情;

想咨詢(xún)互聯(lián)網(wǎng)運(yùn)營(yíng),你可以點(diǎn)擊>>>“互聯(lián)網(wǎng)運(yùn)營(yíng)就業(yè)班”了解課程詳情; 

想了解更多優(yōu)質(zhì)課程,請(qǐng)點(diǎn)擊>>>

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

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

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

OK
客服在線
立即咨詢(xún)
客服在線
立即咨詢(xún)
') } 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, // 表示用戶(hù)后臺(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ù)說(shuō)明請(qǐng)參見(jiàn):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); }