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

熱線電話:13121318867

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

作者:小伍哥 

來源:AI入門學(xué)習(xí)(公眾號)

python中,常見的數(shù)據(jù)可視化庫有3個:

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

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

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

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

看案例

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

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,畫堆疊柱狀圖

df.plot.bar(stacked=True)

02、柱狀圖-橫向

df.plot.barh()

同樣,stacked=True,畫堆疊柱狀圖

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、直方圖

換個數(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')


——熱門課程推薦:

想學(xué)習(xí)PYTHON數(shù)據(jù)分析與金融數(shù)字化轉(zhuǎn)型精英訓(xùn)練營,您可以點(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ù)分析師”了解課程詳情;

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

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

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

若不方便掃碼,搜微信號: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)的第一個參數(shù)驗證碼對象,之后可以使用它調(diào)用相應(yīng)的接口 initGeetest({ // 以下 4 個配置參數(shù)為必須,不能缺少 gt: data.gt, challenge: data.challenge, offline: !data.success, // 表示用戶后臺檢測極驗服務(wù)器是否宕機(jī) new_captcha: data.new_captcha, // 用于宕機(jī)時表示是新驗證碼的宕機(jī) product: "float", // 產(chǎn)品形式,包括:float,popup width: "280px", https: true // 更多配置參數(shù)說明請參見:http://docs.geetest.com/install/client/web-front/ }, handler); } }); } function codeCutdown() { if(_wait == 0){ //倒計時完成 $(".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 = '請輸入'+oInput.attr('placeholder')+'!'; var errTxt = '請輸入正確的'+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); }