Julia 中的数据操作
Katerina Zahradova
Instructor
wages 而非 df wages 而非 us_min_wages_data_between_1968_and_2020_with_inflation_adjusted_columnstate_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)
# 缺失公司所在的行
df[ismissing.(df.company),:]
# 按年份和州透视
unstack(wages, :year, :state, :eff_min_wage)
# 用最小值替换缺失工资
# 作为最坏情况
min = minimum(skipmissing(df.wages))
replace!(df.wages, missing => min)
# 与国家表连接
# 研究国家如何影响质量
leftjoin(company, countries, on=:location)



Julia 中的数据操作