반응형
Notice
Recent Posts
Recent Comments
Link
관리 메뉴

bro's coding

pandas.dt.(dayofweek,year,month,day,weekday,weekday_name) 본문

[IT]/python.pandas

pandas.dt.(dayofweek,year,month,day,weekday,weekday_name)

givemebro 2020. 4. 24. 10:30
반응형
#data_time을 이용해 요일 알아내기
data2.일자.dt.dayofweek

data2['년']=data2.일자.dt.year
data2['월']=data2.일자.dt.month
data2['일']=data2.일자.dt.day
data2['wday']=data2.일자.dt.weekday
data2['wname']=data2.일자.dt.weekday_name

# 0 : 월요일

data2.head()

data2['요일']=data2.일자.dt.weekday.map({0:'월',1:'화',2:'수',3:'목',4:'금',5:'토',6:'일'})
data2.head()

반응형

'[IT] > python.pandas' 카테고리의 다른 글

pandas.groupby  (0) 2020.04.24
pandas.pivot_table  (0) 2020.04.24
pandas.drop_duplicates.reset_index  (0) 2020.04.24
pandas.string2code  (0) 2020.04.24
pandas.get_dummies.ont-hot-incoding  (0) 2020.04.24
pandas.unstack(벡터로 펼치기(인덱스 두개))  (0) 2020.04.06
pandas.groupby  (0) 2020.04.06
pandas. 항목 추가  (0) 2020.04.06
Comments