Skip to content

CLN: redundant function in Styler #39632

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

Merged
merged 1 commit into from
Feb 7, 2021
Merged
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
11 changes: 2 additions & 9 deletions pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,6 @@ def _translate(self):
BLANK_CLASS = "blank"
BLANK_VALUE = ""

def format_attr(pair):
return f"{pair['key']}={pair['value']}"

# for sparsifying a MultiIndex
idx_lengths = _get_level_lengths(self.index)
col_lengths = _get_level_lengths(self.columns, hidden_columns)
Expand Down Expand Up @@ -462,9 +459,7 @@ def format_attr(pair):
}
colspan = col_lengths.get((r, c), 0)
if colspan > 1:
es["attributes"] = [
format_attr({"key": "colspan", "value": f'"{colspan}"'})
]
es["attributes"] = [f'colspan="{colspan}"']
row_es.append(es)
head.append(row_es)

Expand Down Expand Up @@ -508,9 +503,7 @@ def format_attr(pair):
}
rowspan = idx_lengths.get((c, r), 0)
if rowspan > 1:
es["attributes"] = [
format_attr({"key": "rowspan", "value": f'"{rowspan}"'})
]
es["attributes"] = [f'rowspan="{rowspan}"']
row_es.append(es)

for c, col in enumerate(self.data.columns):
Expand Down