to_period() 메서드
dt.to_period(freq=None, axis=0, copy=None)
Series의 날짜 또는 시간 정보로 주어진 freq를 Period 형식으로 변환
매개변수 freq에는 변환하려는 기간의 주기를 지정할 수 있고 "M"은 월단위, "Q"는 분기단위, "A"는 연도단위로 사용
여기서 dt 는 DataTime 속성으로 Series에 접근해서 시계열 데이터를 다룰 수 있음
예제
참고
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_period.html
pandas.DataFrame.to_period — pandas 2.2.3 documentation
If False then underlying input data is not copied. Note The copy keyword will change behavior in pandas 3.0. Copy-on-Write will be enabled by default, which means that all methods with a copy keyword will use a lazy copy mechanism to defer the copy and ign
pandas.pydata.org
https://www.datamanim.com/dataset/99_pandas/pandasMain.html#grouping
'사이언스' 카테고리의 다른 글
Pandas 두 날짜의 차이 계산 datetime.timedelta() (0) | 2024.11.23 |
---|---|
Pandas 이동평균 구하기 rolling().mean() (0) | 2024.11.23 |
판다스 데이터 값 정렬 인덱스 초기화 sort_values().reset_index() (0) | 2024.11.13 |
[TIL] 넘파이 numpy reshape, flatten (0) | 2024.11.11 |
[TIL] 부스트코스 넘파이 NumPy (1) | 2024.11.11 |