简体   繁体   English

AMPLPY 解密和加密

[英]AMPLPY decrypt and encrypt

I am using amplpy to access AMPL from my python.我正在使用 amplpy 从我的 python 访问 AMPL。 I want my dat file to not be in plain text.我希望我的 dat 文件不是纯文本。 Is it possible?可能吗? I cannot find any api to do it我找不到任何 api 来做到这一点

Yes, it's possible.是的,这是可能的。 You can import data from Excel or CSV files.您可以从 Excel 或 CSV 文件导入数据。 Then fed into the data to the .mod file.然后将数据输入到 .mod 文件中。 Here, I am feeding a pandas dataframe to the .mod file.在这里,我将 pandas 数据框提供给 .mod 文件。 One thing to be remembered Pandas dataframe and amplpy dataframe is completely different.要记住的一件事 Pandas 数据帧和 Amplpy 数据帧是完全不同的。

from amplpy import AMPL, DataFrame, Environment

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

ampl.set_data(df_mpij)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM