해결
#데이터 형태
df['start_date_time'] = ["2016-05-19 08:25:00","2016-05-19 16:00:00","2016-05-20 07:45:00","2016-05-24 12:50:00","2016-05-25 23:00:00","2016-05-26 19:45:00"]
#초단위 삭제(Timezone이 제거 될 수 있음)
df['start_date_time'] = df['start_date_time'].values.astype('<M8[m]')
#결과
print (df)
start_date_time
0 2016-05-19 08:25:00
1 2016-05-19 16:00:00
설명
astype을 이용 '<M8[m]'으로 초단위를 제거한단다.
출처
https://stackoverflow.com/questions/43387467/how-to-remove-seconds-from-datetime
'Python3' 카테고리의 다른 글
[python3] Two's compliment(2의 보수) (0) | 2021.09.18 |
---|---|
[python3] 변수 이름을 print()로 화면에 출력하기 (0) | 2021.05.27 |
KeyError: 'val_mean_absolute_error' 해결법 (0) | 2021.05.15 |
나 자신에게 남기는 Python 짧은 팁들 (0) | 2021.04.28 |
jupyterlab 3.0에서 git 설치하기 (0) | 2021.04.06 |