diff --git a/Project.toml b/Project.toml index 99e7141ad..52c88b63d 100644 --- a/Project.toml +++ b/Project.toml @@ -70,7 +70,7 @@ MacroTools = "0.5" FileIO = "1" julia = "1.4" GlobalSensitivityAnalysis = "1.0" -DataFrames = "0.19.1, 0.20, 0.21" +DataFrames = "0.19.1, 0.20, 0.21, 0.22" FilePaths = "0.8" [targets] diff --git a/src/explorer/buildspecs.jl b/src/explorer/buildspecs.jl index eb5df501b..545c43d13 100644 --- a/src/explorer/buildspecs.jl +++ b/src/explorer/buildspecs.jl @@ -1089,10 +1089,11 @@ function trumpet_df_reduce(df, plottype::Symbol) i != col_index && push!(groupby_keys, names(df)[i]) end - df_new = by(df, groupby_keys, value = col => minimum) - append!(df_new, by(df, groupby_keys, value = col => maximum)) - append!(df_new, by(df, groupby_keys, value = col => mean)) - rename!(df_new, :value => col) + gd = DataFrames.groupby(df, groupby_keys) + + df_new = rename!(combine(gd, col => maximum), Symbol(col, :_maximum) => col) + append!(df_new, rename!(combine(gd, col => minimum), Symbol(col, :_minimum) => col)) + append!(df_new, rename!(combine(gd, col => mean), Symbol(col, :_mean) => col)) if plottype == :trumpet reorder_cols = [groupby_keys[1], col, groupby_keys[2:end]...] diff --git a/src/mcs/montecarlo.jl b/src/mcs/montecarlo.jl index 1803a468e..a61b03eb3 100644 --- a/src/mcs/montecarlo.jl +++ b/src/mcs/montecarlo.jl @@ -64,13 +64,13 @@ function _store_param_results(m::AbstractModel, datum_key::Tuple{Symbol, Symbol} if haskey(results, datum_key) results_df = results[datum_key] else - types = [typeof(value), Int] + cols = [[], []] names = [datum_name, :trialnum] if has_scen - push!(types, String) + push!(cols, []) push!(names, :scen) end - results_df = DataFrame(types, names, 0) + results_df = DataFrame(cols, names) results[datum_key] = results_df end