Reading data with dataframe (instead of readdlm), now equations give error



Hey all,

Just because I have changed the way I read the input data, now model equations give me errors. How can I resolve this?

More context here:
I have successfully run optimization model when I was reading the csv files with readdlm command. Given that I have so many input files (csv files) I wanted to use xlsx, and I have put all these csv files in tabs of excel.

Now I am using
Offices= readxlsheet(DataFrame, “Locations_v2.xlsx”, “Offices”)
which has the cost information in column 11 of tab “Offices”:

Cost = Offices[1:size(Offices)[1],11]

However, now I get a lot of error with equations in the model:

My cost data is below:

What am I doing wrong?

Could you help me with my syntax here?
I don’t want to have multiple csv files. I will need excel formulations for my input data and csv does not store formulations. Thus, I need to keep my input data in excel xlsx format. How do you guys typically read data from excel files?

Could you help with the problem above?

Thank you!


One thing to keep in mind is that DataFrame columns are of type DataArray, i.e. they can hold missing data. Downstream packages might not like that type. You can convert things into a normal array with convert(Array, Cost), provided that the input data actually doesn’t have any missing data.

Having said that, the error message seems to indicate that somewhere you are indexing into an array with a Float64, and that might be the problem. But without more info it is difficult to tell.


It looks like i is taking a value of 1.0 which is an invalid index. Indexes must be integers. Your problem must be in the definition of your set I