A DataFrame object, used to communicate data to and from the AMPL entities. An object of this class can be used to do the following tasks:
Assign values to AMPL entities (once the DataFrame is populated, use the AMPL.setData
to assign its values to the modelling entities in its columns)
Get values from AMPL, decoupling the values from the AMPL entities they originate from (via Entity.getValues
)
A DataFrame object can be created in various ways.
Populating a DataFrame object can be done adding row by row to a pre-existing skeleton via DataFrame.addRow
, setting whole columns of a pre-existing skeleton via DataFrame.setColumn
or adding columns (including indexing columns) via DataFrame.addColumn
.
Modifying a DataFrame object can be done via DataFrame.setColumn
or, item by item, via DataFrame.setValue
.
Accessing data in a DataFrame can be done row by row using DataFrame.getRow
or by column via DataFrame.getColumn
. Automated casting of columns is provided via DataFrame.getColumnAsDoubles
and DataFrame.getColumnAsStrings
.