help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Reading Column Headers from CSV files


From: Andrew Makhorin
Subject: Re: [Help-glpk] Reading Column Headers from CSV files
Date: Mon, 14 Dec 2009 02:03:36 +0300

> I #39;m attempting to write a portfolio optimization model in GMPL,
> and would like to read return data from a .cvs file.  The file would
> include a variable number of columns with the column header containing
> a short string for the stock ticker symbol.

> I #39;m having trouble figuring out how to read a variable number of
> columns in GMPL, then use the column headers as entries in a set. Is
> it possible to do this?

The only way is to rearrange the csv file structure.

Rather than using a multi-field csv file like this:

SYMBOL,VALUE1,VALUE2,...,VALUE3
A,0.11,0.12,...,0.13
B,0.21,0.22,...,0.23

you should use the following 3-field csv file:

SYMBOL,PARAM,VALUE
A,VALUE1,0.11
A,VALUE2,0.12
A,VALUE3,0.13
B,VALUE1,0.21
B,VALUE2,0.22
...







reply via email to

[Prev in Thread] Current Thread [Next in Thread]