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 を同一 DataFrame に混在させない新しい変数を増やしすぎない
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 でのデータ操作