Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for deprecation warnings #49

Merged
merged 1 commit into from
Jul 8, 2024
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
6 changes: 3 additions & 3 deletions src/gurobi_logtools/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def fill_default_parameters(summary):
if re_parameter_column.match(column) and series.isnull().any()
]
# TODO test cases where there are different versions involved
return summary.groupby("Version", group_keys=False).apply(
partial(fill_for_version, parameter_columns=parameter_columns)
return summary.groupby("Version", group_keys=False)[summary.columns].apply(
partial(fill_for_version, parameter_columns=parameter_columns),
)


Expand All @@ -44,7 +44,7 @@ def fill_for_version_nosuffix(group):

def fill_default_parameters_nosuffix(parameters):
"""Fill defaults for Version and parameter cols with no (Parameter) suffix."""
return parameters.groupby("Version", group_keys=False).apply(
return parameters.groupby("Version", group_keys=False)[parameters.columns].apply(
fill_for_version_nosuffix
)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_fill_defaults.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pandas as pd
from pandas.api.types import is_categorical_dtype, is_float_dtype, is_integer_dtype
from pandas.api.types import is_float_dtype, is_integer_dtype
from pandas.testing import assert_frame_equal

import gurobi_logtools as glt
Expand All @@ -20,7 +20,7 @@ def test_parameter_values():
def test_pretty_parameters():
summary = glt.get_dataframe(["data/*.log"], prettyparams=True)
presolve = summary["Presolve (Parameter)"]
assert is_categorical_dtype(presolve)
assert isinstance(presolve.dtype, pd.CategoricalDtype)
assert set(presolve.unique()) == {
"-1: Automatic",
"1: Conservative",
Expand Down