Read and Write CSV Files

  • 28 March 2019
  • 4 replies
  • 384 views

Userlevel 2
CSV files are a de facto standard for communication of data. AIMMS provides the libraries
code:
DataLink
and
code:
CSVProvider
for the serializing of CSV files.

In this article an example is provided for reading data from a CSV file.

4 replies

Userlevel 6
Badge +6

Hi Erika

Can I suggest to start using the new Data Exchange Library. This library offers a much more flexible and generic way of communicated data files. We are expecting it to become the standard going forward. 
 

See: 

 

Badge +1

I downloaded the example project and modified the komma\fourrows.csv demand in second line from 1000 to 1000.10 and when I run the procedure, it rounds the value when import it to AIMMS.

What I have to do to get it into AIMMS as 1000.10 ?

Userlevel 5
Badge +5
@MathFour , does your CSV file have headers ? Then just do not refer to the header of the first column in your data map.
Userlevel 4
Badge
It seems that you have to have a clean csv to use this. Is it possible to import a csv where the first "column" isn't used in the model?

For example, if I export a python/pandas dataframe as a csv, it has the index in the first column. How do I "skip" over this while reading it into AIMMS?

And, yes, I can turn it off in python, but I need it there for other things.

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator