Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

A way to create large dictionary? "ERROR: LoadError: syntax: expression too large"

$
0
0

@olugovoy wrote:

Hi there,

What is the best way to create a large dictionary?
This expression works for smaller Dicts:
pDemand = Dict(
(:DEM_ELC_DH, :ELC, :AL, :2018, :d001_h00) => 20.4280246,
(:DEM_ELC_DH, :ELC, :AR, :2018, :d001_h00) => 9.4801576,
(:DEM_ELC_DH, :ELC, :AZ, :2018, :d001_h00) => 12.5974967,
(:DEM_ELC_DH, :ELC, :CA, :2018, :d001_h00) => 22.195113,
(:DEM_ELC_DH, :ELC, :CO, :2018, :d001_h00) => 7.1842716,

)
But if there are 400000+ rows, the error appears:
“ERROR: LoadError: syntax: expression too large”
(which is a bit surprising, I haven’t experienced any limits on expressions length in other languages - like GAMS or Python/Pyomo)

What would be a better way to create a Dictionary in Julia? We use the format as data input & mapping in JuMP.

Here is a big Dict to experiment with: long_dict.jl

Thanks!

Posts: 5

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles