Skip to content

Commit

Permalink
Use getattr to DRY some lines
Browse files Browse the repository at this point in the history
  • Loading branch information
glatterf42 committed Dec 20, 2024
1 parent 883d6a2 commit afd1630
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions ixmp4/data/db/optimization/table/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,7 @@ def data(self) -> dict[str, list[float] | list[int] | list[str]]:
dict[str, list[float] | list[int] | list[str]],
pd.DataFrame.from_records(
[
{
"Column 0": td.value_0,
"Column 1": td.value_1,
"Column 2": td.value_2,
"Column 3": td.value_3,
"Column 4": td.value_4,
"Column 5": td.value_5,
"Column 6": td.value_6,
"Column 7": td.value_7,
"Column 8": td.value_8,
"Column 9": td.value_9,
"Column 10": td.value_10,
"Column 11": td.value_11,
"Column 12": td.value_12,
"Column 13": td.value_13,
"Column 14": td.value_14,
}
{f"Column {i}": getattr(td, f"value_{i}") for i in range(15)}
for td in self._data
]
)
Expand Down

0 comments on commit afd1630

Please sign in to comment.