中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

山南網(wǎng)站建設(shè)網(wǎng)絡(luò)平臺(tái)推廣方案

山南網(wǎng)站建設(shè),網(wǎng)絡(luò)平臺(tái)推廣方案,創(chuàng)建網(wǎng)站大約多少錢,什么系統(tǒng)做網(wǎng)站最安全pandas——plot()方法可視化 作者:AOAIYI 創(chuàng)作不易,如果覺得文章不錯(cuò)或能幫助到你學(xué)習(xí),記得點(diǎn)贊收藏評(píng)論哦 在此,感謝你的閱讀 文章目錄pandas——plot()方法可視化一、實(shí)驗(yàn)?zāi)康亩?、?shí)驗(yàn)原理三、實(shí)驗(yàn)環(huán)境四、實(shí)驗(yàn)內(nèi)容五、實(shí)驗(yàn)步驟…

pandas——plot()方法可視化

作者:AOAIYI
創(chuàng)作不易,如果覺得文章不錯(cuò)或能幫助到你學(xué)習(xí),記得點(diǎn)贊收藏評(píng)論哦
在此,感謝你的閱讀


文章目錄

  • pandas——plot()方法可視化
  • 一、實(shí)驗(yàn)?zāi)康?/li>
  • 二、實(shí)驗(yàn)原理
  • 三、實(shí)驗(yàn)環(huán)境
  • 四、實(shí)驗(yàn)內(nèi)容
  • 五、實(shí)驗(yàn)步驟


一、實(shí)驗(yàn)?zāi)康?/h1>

熟練掌握使用pandas中數(shù)據(jù)用plot方法繪制圖

二、實(shí)驗(yàn)原理

繪圖方法允許除了默認(rèn)的線圖之外的一些繪圖樣式,這些方法可以通過plot()的關(guān)鍵字參數(shù)kind提供。這些包括:

bar 、barh:繪制條形圖

hist:繪制直方圖

box:繪制箱型圖

kde、density:繪制密度圖

area:面積圖

scatter:繪制散點(diǎn)圖

hexbin:棱形圖

pie:繪制餅圖

三、實(shí)驗(yàn)環(huán)境

Python 3.6.0以上

Jupyter

四、實(shí)驗(yàn)內(nèi)容

練習(xí)使用pandas中數(shù)據(jù)用plot方法繪制圖。

五、實(shí)驗(yàn)步驟

1.編寫代碼,使用Series的plot繪制Series中數(shù)據(jù)的分布圖

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
ts = pd.Series(np.random.randn(1000),index=pd.date_range('1/1/2000',periods=1000)) #創(chuàng)建一個(gè)Series
ts = ts.cumsum() #對(duì)Series數(shù)據(jù)進(jìn)行累加求和
ts.plot() #使用plot方法繪制Series中數(shù)據(jù)分布圖
plt.show()

在這里插入圖片描述

2.創(chuàng)建一個(gè)DataFrame名為df,使用df的plot繪制df中數(shù)據(jù)的分布圖,代碼如下:

import numpy as np
import pandas as pd
import matplotlib.pyplot as pltts = pd.Series(np.random.randn(1000),index=pd.date_range('1/1/2000',periods=1000)) #創(chuàng)建一個(gè)Series
df = pd.DataFrame(np.random.randn(1000,4),index=ts.index,columns=list('ABCD')) #創(chuàng)建一個(gè)DataFrame
df = df.cumsum() #對(duì)df數(shù)據(jù)進(jìn)行累加求和df.plot()
plt.show()

在這里插入圖片描述

3.創(chuàng)建一個(gè)DataFrame名為df,使用df的plot方法繪制df第6行數(shù)據(jù)的條形圖,代碼如下:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
ts = pd.Series(np.random.randn(1000),index=pd.date_range('1/1/2000',periods=1000)) #創(chuàng)建一個(gè)Series
df = pd.DataFrame(np.random.randn(1000,4),index=ts.index,columns=list('ABCD')) #創(chuàng)建一個(gè)DataFrame
df = df.cumsum() #對(duì)df數(shù)據(jù)進(jìn)行累加求和
df.iloc[5].plot(kind='bar')
plt.axhline(0,color='k')
plt.show()

在這里插入圖片描述

4.創(chuàng)建一個(gè)DataFrame名為df2,使用df2的plot.bar()方法繪制df2數(shù)據(jù)的條形圖,代碼如下:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df2 = pd.DataFrame(np.random.rand(10,4),columns=['a','b','c','d'])
df2.plot.bar()
plt.show()

在這里插入圖片描述

5.使用plot.bar方法對(duì)上述df2數(shù)據(jù)繪制一個(gè)堆疊的條形圖,通過設(shè)置參數(shù)stacked=True,代碼如下:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df2 = pd.DataFrame(np.random.rand(10,4),columns=['a','b','c','d'])
df2.plot.bar(stacked=True)
plt.show()

在這里插入圖片描述

6.使用plot.barh方法對(duì)上述df2數(shù)據(jù),通過設(shè)置參數(shù)stacked=True,繪制一個(gè)水平堆疊條形圖,代碼如下:

import numpy as np  
import pandas as pd  
import matplotlib.pyplot as plt  
df2 = pd.DataFrame(np.random.rand(10, 4), columns=['a', 'b', 'c', 'd'])  
df2.plot.barh(stacked=True)  
plt.show()  

在這里插入圖片描述

7.創(chuàng)建一個(gè)DataFrame名為df3,使用df3的plot.hist()方法繪制df3數(shù)據(jù)的直方圖,代碼如下:

import numpy as np  
import pandas as pd  
import matplotlib.pyplot as plt  
df3 = pd.DataFrame({'a': np.random.randn(1000) + 1, 'b': np.random.randn(1000),'c': np.random.randn(1000) - 1}, columns=['a', 'b', 'c'])  
df3.plot.hist(alpha=0.5)  
plt.show()

在這里插入圖片描述

8.使用plot.hist()方法對(duì)上述df3數(shù)據(jù),通過設(shè)置堆疊參數(shù)stacked=True,設(shè)置條數(shù)大小參數(shù)bins=20,繪制一個(gè)堆疊直方圖,代碼如下:

import numpy as np  
import pandas as pd  
import matplotlib.pyplot as plt  
df3 = pd.DataFrame({'a': np.random.randn(1000) + 1, 'b': np.random.randn(1000),'c': np.random.randn(1000) - 1}, columns=['a', 'b', 'c'])  
df3.plot.hist(stacked=True, bins=20)  
plt.show() 

在這里插入圖片描述

9.創(chuàng)建一個(gè)DataFrame名為df4,使用df4的plot.box()方法繪制df3數(shù)據(jù)的箱型圖,代碼如下:

import numpy as np  
import pandas as pd  
import matplotlib.pyplot as plt  
df4 = pd.DataFrame(np.random.rand(10, 5), columns=['A', 'B', 'C', 'D', 'E'])  
df4.plot.box()  
plt.show()  

在這里插入圖片描述

10.創(chuàng)建一個(gè)DataFrame名為df5,使用df5的plot.scatter()方法繪制df5數(shù)據(jù)的散點(diǎn)圖,代碼如下:

import numpy as np  
import pandas as pd  
import matplotlib.pyplot as plt  
df5 = pd.DataFrame(np.random.rand(50, 4), columns=['a', 'b', 'c', 'd'])  
df5.plot.scatter(x='a', y='b');  
plt.show()  

在這里插入圖片描述

11.創(chuàng)建一個(gè)DataFrame名為df6,使用df6的plot.pie()方法繪制df6數(shù)據(jù)的餅圖,代碼如下:

import numpy as np  
import pandas as pd  
import matplotlib.pyplot as plt  
df6 = pd.DataFrame(3 * np.random.rand(4, 2), index=['a', 'b', 'c', 'd'], columns=['x', 'y'])  
df6.plot.pie(subplots=True, figsize=(8, 4))  
plt.show()  

在這里插入圖片描述


http://www.risenshineclean.com/news/64902.html

相關(guān)文章:

  • 做編程題的網(wǎng)站全國新冠疫苗接種率
  • seo營銷網(wǎng)站的設(shè)計(jì)標(biāo)準(zhǔn)百度快照優(yōu)化
  • 有什么專門搜試卷做的網(wǎng)站app推廣平臺(tái)排行榜
  • 重慶裝修貸廣州seo服務(wù)外包
  • 廣州天河區(qū)網(wǎng)站建設(shè)搜索引擎推廣有哪些
  • 移動(dòng)端是指手機(jī)還是電腦優(yōu)化大師如何刪掉多余的學(xué)生
  • 安卓市場2022最新版下載河南網(wǎng)站關(guān)鍵詞優(yōu)化
  • 蘇州網(wǎng)站建設(shè)選蘇州夢易行百度網(wǎng)游排行榜
  • 余姚網(wǎng)站制作軟文營銷是什么意思
  • 俄文網(wǎng)站策劃搜索引擎都有哪些
  • 燕郊做網(wǎng)站的外貿(mào)網(wǎng)站建設(shè) google
  • 淘客軟件自動(dòng)做網(wǎng)站百度網(wǎng)址大全舊版
  • 網(wǎng)站界面用什么軟件做百度云電腦版網(wǎng)站入口
  • 適合做外鏈的網(wǎng)站互聯(lián)網(wǎng)平臺(tái)
  • 社區(qū)問答網(wǎng)站開發(fā)谷歌推廣開戶
  • 杭州網(wǎng)站建設(shè)杭州磁力引擎
  • 百度網(wǎng)站快速排名公司重慶seo網(wǎng)絡(luò)推廣
  • 佛山市城市建設(shè)檔案館網(wǎng)站競猜世界杯
  • 深圳網(wǎng)站建設(shè)html5惠州seo怎么做
  • 做外貿(mào)收費(fèi)的網(wǎng)站seo交流論壇
  • 買公司的網(wǎng)站建設(shè)北京seo顧問外包
  • 盤古建站模板seo研究中心論壇
  • 河南官網(wǎng)網(wǎng)站建設(shè)廣告語
  • 互動(dòng)網(wǎng)站設(shè)計(jì)與制作提供seo顧問服務(wù)適合的對(duì)象是
  • 上海裝修公司做網(wǎng)站seo日常工作
  • 小網(wǎng)站建設(shè)360搜索引擎
  • 西藏做網(wǎng)站找誰網(wǎng)址關(guān)鍵詞查詢網(wǎng)站
  • 一諾建站廣東省人大常委會(huì)
  • 自貢做網(wǎng)站的公司百度快速收錄賬號(hào)購買
  • ftp網(wǎng)站目錄深圳關(guān)鍵詞優(yōu)化公司哪家好