-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
PERF: Styler #43285
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
PERF: Styler #43285
Conversation
nice. good spot. lgtm. tests seem unrelated. there might be one or two other places this pattern might be better too. |
@@ -1023,7 +1023,8 @@ def _update_ctx(self, attrs: DataFrame) -> None: | |||
) | |||
|
|||
for cn in attrs.columns: | |||
for rn, c in attrs[[cn]].itertuples(): | |||
ser = attrs[cn] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ser = attrs[cn] | |
j = self.columns.get_loc(cn) | |
ser = attrs[cn] |
(remove repeated j lookup below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can actually go further and just do for j, cn in enumerate(attrs.columns):
, but will ask you to do that in #43287
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't becuase of subset
, we are cross matching objects:
i.e.
self.columns ~ ["a", "b", "c", "d"]
attrs.columns ~ ["b", "d"]
=> j ~ [1, 3] # not enumerate
thanks @jbrockmendel |
cc @attack68