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
Asked
Active
Viewed 37 times
1 Answers
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)

Md Fantacher Islam
- 82
- 5