Julia로 하는 데이터 조작
Katerina Zahradova
Instructor
df 대신 wagesus_min_wages_data_between_1968_and_2020_with_inflation_adjusted_column 대신 wagesstate_wage_2020와 effective.2020.dollars를 섞으면 기억하기 어려움state, Year, REGION 혼용은 피하기새 변수를 너무 많이 만들지 않기
wages_no_missing, wages_missing_state_only, wages_original_no_missing, wages_state_mean_no_missing 등 차이 파악 어려움덮어쓰기 사용: select!(), transform!() 등
chain 매크로 사용# 이렇게
replace_missing = 0
replace!(df.col1, missing => replace_missing)
replace!(df.col2, missing => replace_missing)
# 이렇게 말고
replace!(df.col1, missing => 0)
replace!(df.col2, missing => 0)
# 여러 개 선 그래프를 라벨과 함께 그리는 함수
function make_line_plot(xs, ys,labels; xlabel="", ylabel="", title="")
p = plot(title = title, xlabel = xlabel, ylabel = ylabel)
for (x, y, label) in zip(xs, ys, labels)
plot!(x, y, label=label)
end
p
end
# 이름 표준화
rename!(df, :ColumnOne => :col_1)
# company가 없는 행
df[ismissing.(df.company),:]
# year와 state로 피벗
unstack(wages, :year, :state, :eff_min_wage)
# 누락 임금을 최솟값으로 대체
# 최악의 경우 가정
min = minimum(skipmissing(df.wages))
replace!(df.wages, missing => min)
# 국가 데이터와 조인
# 국가가 품질에 미치는 영향 분석
leftjoin(company, countries, on=:location)



Julia로 하는 데이터 조작