import matplotlib.pyplot as plt
get_ipython().run_line_magic("matplotlib","inline")

import numpy as np
t = np.arrange(0,12,0.01) #t = 1200개
y = np.sin(t)
def drawGrap():
plt.figure(figsize=(10,6))
plt.plot(t,np.sin(t), label="sin")
plt.plot(t,np.cos(t), label="cos")
plt.grid()
plt.legend()
plt.xlabel("time")
plt.ylabel("Amplitude")
plt.title("Example of sinewave")
plt.show()


[참고] matplotlib 공식사이트
:
https://matplotlib.org/stable/gallery/index

fp1 = np.polyfit(data_result["인구수"],data_result["소계"], 1)
f1 = np.poly1d(fp1) #예측값(경향선)
fx = np.linspace(10000,70000,100)
#오차 : 실제값 - 예측값
data_result["오차"] = data_result["소계"] - f1(data_result["인구수"])
#경향과 비교해서 데이터 오차가 너무 나는 데이터를 계산
df_sort_f = data_result.sort_values(by="오차", ascending=False) #오차가 가장많은구부터
df_sort_t = data_result.sort_values(by="오차", ascending=True)
