코딩 공부/Pandas
Pandas와 친해지기(10분 Pandas) (2024-02-05)
kyeob
2024. 2. 5. 15:11
Plotting (2024-02-05)¶
In [ ]:
import matplotlib.pyplot as plt
plt.close("all") # 왜 이것부터 시작한지는 모르겠지만 열려있는 모든 figure창을 닫아주는 메소드인듯하다
In [ ]:
ts = pd.Series(np.random.randn(1000), index=pd.date_range("1/1/2000", periods=1000))
ts = ts.cumsum()
ts.plot()
<Axes: >
cumsum은 누적합계를 해주는 메소드인듯하다
https://pandas.pydata.org/docs/reference/api/pandas.Series.cumsum.html
In [ ]:
df = pd.DataFrame(
np.random.randn(1000,4), index=ts.index, columns=["A", "B", "C", "D" ]
)
df = df.cumsum()
plt.figure();
df.plot();
plt.legend(loc='best');
<Figure size 640x480 with 0 Axes>
파이썬에서느 일반적으로 세미콜론 안 적는 듯한데 왜 적어준지 모르겠음
https://chat.openai.com/share/4ae0e28e-30a6-4f04-bf75-6eb8dfc91ec1