- Python資料科學教程
- Python資料科學——主頁
- Python資料科學——入門
- Python資料科學——環境設定
- Python資料科學——Pandas
- Python資料科學——Numpy
- Python資料科學——SciPy
- Python資料科學——Matplotlib
- Python資料處理
- Python資料操作
- Python資料清洗
- Python處理CSV資料
- Python處理JSON資料
- Python處理XLS資料
- Python關係型資料庫
- Python NoSQL 資料庫
- Python日期和時間
- Python資料整理
- Python資料聚合
- Python閱讀HTML頁面
- Python處理非結構化資料
- Python單詞標記
- Python詞幹提取和詞形還原
- Python資料視覺化
- Python圖表屬性
- Python圖表樣式
- Python箱形圖
- Python熱力圖
- Python散點圖
- Python氣泡圖
- Python 3D 圖表
- Python時間序列
- Python地理資料
- Python圖表資料
Python——正態分佈
正態分佈是一種透過排序資料中每個值機率分佈,展示資料形式的方法。大多數值位於平均值附近,形成了對稱圖案。
我們在numpy函式庫中使用不同的函式,用數學方法計算正態分佈的值。我們在上面繪製了機率分佈曲線來建立直方圖。
import matplotlib.pyplot as plt
import numpy as np
mu, sigma = 0.5, 0.1
s = np.random.normal(mu, sigma, 1000)
# Create the bins and histogram
count, bins, ignored = plt.hist(s, 20, normed=True)
# Plot the distribution curve
plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *
np.exp( - (bins - mu)**2 / (2 * sigma**2) ), linewidth=3, color='y')
plt.show()
它的輸出如下−
廣告