Data Science/coding pratice
차트 시각화 - 시계열 그래프 그리기
희스레저
2022. 11. 24. 11:21
https://joyfuls.tistory.com/54
[Python 머신러닝] 2장. 차트 시각화 - (3)시계열 데이터
3. 시계열 데이터 시각화 """ 1. 날짜형식 수정 2. 시계열 시각화 3. 이동평균 기능 -> 시각화 """ from datetime import datetime # 패키지 - 모듈 (이름 같음) import pandas as pd # csv file read import matplotlib.pyplot as pl
joyfuls.tistory.com
날짜 or 시간데이터
pd.datetime()으로 type바꾼 후
dt.year 등 형식 바꾸기
-
# 날짜데이터를 index로 사용하면 연단위, 월단위, 일단위 검색 가능
groupby이후 reset_index()를 하지 않음(column화 안 한다)
ex) date 데이터가 2022-11-24 이런 식일때,
df['2022'].plot() 형식으로 그리면 됨