# Python 101 筆記
**#1 np.random.normal()**
``` python=
import numpy as np
mean = 0
std = 0.1
y = np.random.normal(mean, std ,size = 10)#size預設=None(只有一個)
```
np.random.normal(mean,std,size):
* mean:float 此概率分佈的均值(對應著整個分佈的中心centre)
* std:float 此概率分佈的標準差(對應於分佈的寬度,scale越大越矮胖,scale越小,越瘦高)
* size:int or tuple of ints 輸出的shape,預設為None,只輸出一個值
表示均值為mean,標準差為std的高斯隨機數(場).
即與高斯分佈(Gaussian Distribution)的概率密度函式(probability density function):(維基百科)
https://en.wikipedia.org/wiki/Normal_distribution
**#2 plt.hist()**
``` python=
import matplotlib.pyplot as plt
n, bins, patches = plt.hist(y, num_bins, density=1, rwidth=0.9, color='blue', alpha=0.5)
```
* y:直方圖的y值
* num_bins:多少個長方塊
* density:請設定等於1,符合機率理論(機率密度總和=1)
* rwidth:每條長方塊的寬度
* color:顏色
* aplha:透明度
**#3 plt.plot()**
``` python=
import matplotlib.pyplot as plt
...(略)
plt.plot(bins, 1/(std * np.sqrt(2 * np.pi)) * np.exp( - (bins - mean)**2 / (2 * std**2)), linewidth=2, color='r')
#畫出曲線圖
```
plt.plot(x, y, linewidth=2, color='r'):
* x:x軸的座標值
* y:函數
* linewidth:線條寬度
* color:顏色
**#4 data = pd.read_csv(csv_file)**
``` python=
import pandas as pd
csv_file = "https://raw.githubusercontent.com/jerrylin1121/tmp_data/master/total-confirmed-cases-of-covid-19-per-million-people.csv"
data = pd.read_csv(csv_file)
data.head(10)#顯示出前10筆資料
```
**#5 sns_plot = sns.relplot(, , , )**
``` python=
import seaborn as sns
sns_plot = sns.relplot(x='Year', y='Total confirmed cases of COVID-19 per million people (cases per million)', kind='line', data=data)
#會顯示信賴區間
```