<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

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

          共 2460字,需瀏覽 5分鐘

           ·

          2020-04-23 23:22


          b101888135e727d6a44aac75d788d72b.webp


          ? ???作者:朱衛(wèi)軍


          ? ? ?來源:Python大數(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()
          bb35899c064bcef64a8356ba63ecfabf.webp
          import?seaborn?as?sns
          #?導(dǎo)出鳶尾花數(shù)據(jù)集
          data?=?sns.load_dataset('iris')
          data.head()
          be24d544dc2778b8e58448a338c1ca27.webp

          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()
          98d936cf1b9d78acb98f7696191d0833.webp

          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()
          8959b14be74fe0a165ed4181310cf81e.webp

          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()
          902bf647cc841ce26d696593e128cb1d.webp

          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()
          470c50d3fc3861545b5d9c74c2463865.webp

          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()
          6c1b83f8cfb698d36aeffcd6edbbd15f.webp

          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()
          66021110a4c6ee6003af02ad3a6e5c0a.webp

          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()
          a47d50ee25d0d9db493c03a818631b13.webp

          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()
          af5291050abd13b1039aad1450e54194.webp

          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()
          9d6489eab807601a15d83c57e2aeef15.webp

          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()
          fd1c68ce641eb74b2ba057274f4017ca.webp

          ◆?◆?◆ ?◆?



          長按二維碼關(guān)注我們



          數(shù)據(jù)森麟公眾號(hào)的交流群已經(jīng)建立,許多小伙伴已經(jīng)加入其中,感謝大家的支持。大家可以在群里交流關(guān)于數(shù)據(jù)分析&數(shù)據(jù)挖掘的相關(guān)內(nèi)容,還沒有加入的小伙伴可以掃描下方管理員二維碼,進(jìn)群前一定要關(guān)注公眾號(hào)奧,關(guān)注后讓管理員幫忙拉進(jìn)群,期待大家的加入。


          管理員二維碼:


          猜你喜歡

          ?笑死人不償命的知乎沙雕問題排行榜

          ?用Python扒出B站那些“驚為天人”的阿婆主!

          ?全球股市跳水大戰(zhàn),誰最坑爹!

          ?上萬條數(shù)據(jù)撕開微博熱搜的真相!

          ?你相信逛B站也能學(xué)編程嗎

          瀏覽 66
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  青青草视频免费在线看 | 免费观看黄色亚洲网站 | 在线免费观看国产精品 | 免费视频在线观看一区 | 亚洲天堂在线观看一区 |