Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 반복문
- 분류 결과표
- append()
- elbow method
- len()
- string
- analizer
- data
- hierarchical_clustering
- sklearn
- 최솟값
- count()
- IN
- DataFrame
- matplotlib
- nan
- del
- function
- wcss
- Python
- DataAccess
- Machine Learning
- Dictionary
- dendrogram
- 최댓값
- list
- numpy
- insert()
- pandas
- 덴드로그램
Archives
- Today
- Total
개발공부
[Python] Numpy 시간 처리 방법 np.datetime64 본문
Numpy 시간 처리 방법 np.datetime64
기존의 파이썬 datetime 을 보강하기 위해,
date 의 array 도 처리할 수 있게 numpy 에서 64-bit 로 처리하도록 라이브러리를 강화했다.
생성은 아래와 같이 할 수 있다.
>>> import numpy as np
>>> any_date = np.array('2022-05-11', dtype = np.datetime64)
>>> any_date
array('2022-05-11', dtype='datetime64[D]')
날짜 연산
넘파이의 datetime64는 날짜 연산이
단순하게 + - 연산자를 이용하면 돼서 간편하다.
>>> any_date + 10
numpy.datetime64('2022-05-21')
>>> any_date - 20
numpy.datetime64('2022-04-21')
>>> any_date + np.arange(10)
array(['2022-05-11', '2022-05-12', '2022-05-13', '2022-05-14',
'2022-05-15', '2022-05-16', '2022-05-17', '2022-05-18',
'2022-05-19', '2022-05-20'], dtype='datetime64[D]')'Python > Numpy' 카테고리의 다른 글
| [Python] Numpy 연산, 브로드 캐스팅(broadcasting) (0) | 2022.04.29 |
|---|---|
| [Python] Numpy 중복 제거 unique() (0) | 2022.04.29 |
| [Python] Numpy 항목 추가하기 append(), insert() (0) | 2022.04.29 |
| [Python] Numpy 항목 삭제하기 delete (0) | 2022.04.28 |
| [Python] Numpy 최댓값, 최솟값의 인덱스 구하기 (0) | 2022.04.28 |