Skip to content

Commit

Permalink
Merge pull request #292 from jrycw/possible-improvements
Browse files Browse the repository at this point in the history
Various possible improvements
  • Loading branch information
machow committed Apr 16, 2024
2 parents 9bebd91 + a726781 commit 14ce2c5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
9 changes: 2 additions & 7 deletions great_tables/_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@


def body_reassemble(body: Body, row_groups: RowGroups, stub_df: Stub, boxhead: Boxhead) -> Body:
cols = [col_info.var for col_info in boxhead]

start_final = get_row_reorder_df(row_groups, stub_df)
rows = [final for _, final in start_final]

# TODO: once body is just a DataFrame, we can call reorder directly on it
# return body.__class__(reorder(body.body, rows, cols))
# Note that this used to order the body based on groupings, but now that occurs in the
# renderer itself.
return body.__class__(copy_data(body.body))
1 change: 0 additions & 1 deletion great_tables/_boxhead.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def cols_label(self: GTSelf, **kwargs: Any) -> GTSelf:
return self

mod_columns = list(kwargs.keys())
new_labels = list(kwargs.values())

# Get the full list of column names for the data
column_names = self._boxhead._get_columns()
Expand Down
4 changes: 1 addition & 3 deletions great_tables/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,14 @@ def _assert_str_list(x: Any) -> None:


def _assert_str_in_set(x: str, set: List[str]):
while x not in set:
if x not in set:
raise AssertionError(f"The string `{x}` is not part of the defined `set`.")


def _assert_list_is_subset(x: List[Any], set_list: List[Any]) -> None:
if not set(x).issubset(set(set_list)):
raise AssertionError("The columns provided are not present in the table.")

return


def _str_scalar_to_list(x: str):
_assert_str_scalar(x)
Expand Down

0 comments on commit 14ce2c5

Please sign in to comment.