Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Version 0.4.4
* Solution files that following a different naming scheme of variables and constraints using more than on initial letter in the prefix (e.g. `col123`, `row456`) are now supported.
* GLPK solver is always called with the `--freemps` option instead of the `--mps` when using the Solver API to solve an external MPS file. `--mps` is for the older fixed-column MPS format that is rarely used nowadays. Almost all fixed MPS files can be parsed by the free MPS format.

* Added extra argument in io methods `explicit_coordinate_names` to allow for export of
variables and constraints with explicit coordinate names.

Version 0.4.3
--------------

Expand Down
6 changes: 5 additions & 1 deletion linopy/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ def set_int_index(series: pd.Series) -> pd.Series:
"""
Convert string index to int index.
"""

if not series.empty and not pd.api.types.is_integer_dtype(series.index):
cutoff = count_initial_letters(str(series.index[0]))
series.index = series.index.str[cutoff:].astype(int)
try:
series.index = series.index.str[cutoff:].astype(int)
except ValueError:
series.index = series.index.str.replace(".*#", "", regex=True).astype(int)
return series


Expand Down
Loading
Loading