본문 바로가기

언어 꿀Tip/Python 꿀tip!

07_01_17. 데이터 프레임 주차 나오게 하기

pd.to_datetime(tmp_df['oper_dt'], format='%Y%m%d').apply(lambda x: x.isocalendar()[0])

pd.to_datetime(tmp_df['oper_dt'], format='%Y%m%d').apply(lambda x: str(x.isocalendar()[0])+'W'+str(x.isocalendar()[1]))