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

**URL:** <https://discourse.julialang.org/t/reading-data-with-dataframe-instead-of-readdlm-now-equations-give-error/5858>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, data\
**Created:** [September 12, 2017, 7:51pm UTC](https://discourse.julialang.org/t/reading-data-with-dataframe-instead-of-readdlm-now-equations-give-error/5858 "2017-09-12T19:51:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Halil1](https://avatars.discourse-cdn.com/v4/letter/h/d9b06d/32.png) [@Halil1](https://discourse.julialang.org/u/Halil1)\
**Post date:** [September 12, 2017, 7:51pm UTC](https://discourse.julialang.org/t/reading-data-with-dataframe-instead-of-readdlm-now-equations-give-error/5858/1 "2017-09-12T19:51:24Z")

</div>

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:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/9/190f7aeb0acbdfdbb0d2fabd3c181b73337e7856.png)

My cost data is below:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/a/7ae5c3c70cbdbe1b6cc31daf2928f2f2099dbb60.png)

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!

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [September 12, 2017, 9:08pm UTC](https://discourse.julialang.org/t/reading-data-with-dataframe-instead-of-readdlm-now-equations-give-error/5858/2 "2017-09-12T21:08:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bbrunaud](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bbrunaud/32/1737_2.png) [@bbrunaud](https://discourse.julialang.org/u/bbrunaud)\
**Post date:** [September 28, 2017, 7:39am UTC](https://discourse.julialang.org/t/reading-data-with-dataframe-instead-of-readdlm-now-equations-give-error/5858/3 "2017-09-28T07:39:38Z")

</div>

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`
