I have a constraint where the index is something akin to the following:
('TEST', 'Apple-Banana Redo', 1, 1)
when adding this constraint directly through Gurobi, this would return an error due to incorrect characters. However, in gurobipy-pandas, I noticed the "bad" characters are automatically replaced with _, as in the following:
'c_test[TEST,Apple_Banana_Redo,1,1]'
This presents an issue when we go to extract outputs from the model and merge things back on to our original dataframes, since now the index has changed. Either we merge rows out or see NA values when left merging.
I think that this line should be modified, preferably to raise an error instead of just performing the string replace:
return index.map(str).str.replace(r"[\+\-\*\^\:\s]+", "_", regex=True)
I also think it's probably worth it to fix the datetime conditional branch as well - this should really force users to have datetimes represented in "%Y_%m_%dT%H_%M_%S" formatting.
I have a constraint where the index is something akin to the following:
when adding this constraint directly through Gurobi, this would return an error due to incorrect characters. However, in gurobipy-pandas, I noticed the "bad" characters are automatically replaced with
_, as in the following:This presents an issue when we go to extract outputs from the model and merge things back on to our original dataframes, since now the index has changed. Either we merge rows out or see NA values when left merging.
I think that this line should be modified, preferably to raise an error instead of just performing the string replace:
I also think it's probably worth it to fix the datetime conditional branch as well - this should really force users to have datetimes represented in
"%Y_%m_%dT%H_%M_%S"formatting.