DataScience
article thumbnail
728x90

basic2.csv
0.02MB

 

2022년 5월 Sales의 중앙값을 구하시오

library(dplyr)
library(lubridate)
df<-read.csv('../input/bigdatacertificationkr/basic2.csv')
df%>%mutate(year=year(Date),month=month(Date))
    %>%filter(year==2022&month==5)
    %>%summarise(med=median(Sales,na.rm=T))
    
#정답 : 1477685

 

암기

library(lubridate)

날짜
lubridate
year()
year(2022-01-01) return값:2022
날짜
lubridate
month()
month(2022-01-01) return값:1

 

 

 

profile

DataScience

@Ninestar

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!