Datamanipulering i Julia
Katerina Zahradova
Instructor
wages hellre än df wages hellre än us_min_wages_data_between_1968_and_2020_with_inflation_adjusted_columnstate_wage_2020 och effective.2020.dollars är svårt att hålla reda påstate, Year och REGION i samma DataFrameSkapa inte för många nya variabler
wages_no_missing, wages_missing_state_only, wages_original_no_missing, wages_state_mean_no_missing osv.?Skriv över! Använd select!(), transform!() osv.
chain-makron för att minska behovet av nya versioner av samma data# Rather
replace_missing = 0
replace!(df.col1, missing => replace_missing)
replace!(df.col2, missing => replace_missing)
# Than
replace!(df.col1, missing => 0)
replace!(df.col2, missing => 0)
# Function to plot multiple lineplots with labels
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
# Standardize names
rename!(df, :ColumnOne => :col_1)
# Lines with missing company
df[ismissing.(df.company),:]
# Pivoting on year and state
unstack(wages, :year, :state, :eff_min_wage)
# Replace missing wages by minimum
# As the worst case
min = minimum(skipmissing(df.wages))
replace!(df.wages, missing => min)
# Joining with countries
# To study how countries influence quality
leftjoin(company, countries, on=:location)



Datamanipulering i Julia