直方圖

Python 中級

Hugo Bowne-Anderson

Data Scientist at DataCamp

直方圖

  • 探索資料集
  • 掌握分佈概況
Python 中級

直方圖

  • 探索資料集
  • 掌握分佈概況

Python 中級

直方圖

  • 探索資料集
  • 掌握分佈概況

Python 中級

直方圖

  • 探索資料集
  • 掌握分佈概況

Python 中級

直方圖

  • 探索資料集
  • 掌握分佈概況

Python 中級

直方圖

  • 探索資料集
  • 掌握分佈概況

Python 中級

直方圖

  • 探索資料集
  • 掌握分佈概況

Python 中級

Matplotlib

import matplotlib.pyplot as plt
help(plt.hist)
Help on function hist in module matplotlib.pyplot:
hist(x, bins=None, range=None, density=False, weights=None, 
cumulative=False, bottom=None, histtype='bar', align='mid', 
orientation='vertical', rwidth=None, log=False, color=None, 
label=None, stacked=False, *, data=None, **kwargs)
    Plot a histogram.

    Compute and draw the histogram of *x*.  The return value is a 
    tuple (*n*, *bins*, *patches*) or ([*n0*, *n1*, ...], 
    *bins*, [*patches0*, *patches1*, ...]) if the input contains 
    multiple data.
Python 中級

Matplotlib 範例

values = [0,0.6,1.4,1.6,2.2,2.5,2.6,3.2,3.5,3.9,4.2,6]

plt.hist(values, bins=3)
plt.show()

Python 中級

人口金字塔

Python 中級

人口金字塔

Python 中級

一起來練習吧!

Python 中級

Preparing Video For Download...