1

I am using amplpy to access AMPL from my python. I want my dat file to not be in plain text. Is it possible? I cannot find any api to do it

user903772
  • 1,554
  • 5
  • 32
  • 55

1 Answers1

0

Yes, it's possible. You can import data from Excel or CSV files. Then fed into the data to the .mod file. Here, I am feeding a pandas dataframe to the .mod file. One thing to be remembered Pandas dataframe and amplpy dataframe is completely different.

from amplpy import AMPL, DataFrame, Environment

df_mpij=DataFrame.fromPandas(df_mpij, index_names=('nodes','dertype'))

ampl.set_data(df_mpij)