介紹
兩組數據在不同時間點的差異檢驗結果線圖
導入包
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy import stats
輸入數據
ctr = [2, 2, 3, 3, 4, 5, 5, 6, 4, 8, 6, 6, 9, 11, 12, 12, 15, 16, 20, 25, 27]
drug = [2, 3, 2, 3, 4, 3, 3, 4, 5, 5, 6, 6, 8, 7, 6, 7, 8, 11, 10, 11, 15]week = []
for x in range(1, 8):week += [x, x, x]
week += week vals = ctr + druglabels = ['Control'] * 21 + ['Drug_z'] * 21df = pd.DataFrame(zip(vals, week, labels), columns = ['Tumor size', 'Week', 'Treatment'])df.head()