Skip to content

Conversation

@lukemanley
Copy link
Member

@lukemanley lukemanley commented Dec 5, 2023

existing test: test_join_with_categorical_index

import pandas as pd import numpy as np categories = [f"cat_{i:03}" for i in range(1000)] idx1 = pd.CategoricalIndex(np.repeat(categories, 1000), categories=categories) idx2 = pd.CategoricalIndex(categories[100:200], categories=reversed(categories)) df1 = pd.DataFrame({"val1": 1}, index=idx1) df2 = pd.DataFrame({"val2": 2}, index=idx2) %timeit df1.join(df2) # 129 ms ± 7.93 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) -> main # 28.4 ms ± 1.18 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) -> PR 
@lukemanley lukemanley added Performance Memory or execution speed performance Reshaping Concat, Merge/Join, Stack/Unstack, Explode Categorical Categorical Data Type labels Dec 5, 2023
@lukemanley lukemanley added this to the 2.2 milestone Dec 5, 2023

def _can_join_monotonic(self, other):
if (
# not isinstance(self.dtype, CategoricalDtype)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Is this still relevant?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, forgot to remove that. Its now removed. thanks

@mroeschke mroeschke merged commit f2b3795 into pandas-dev:main Dec 6, 2023
@mroeschke
Copy link
Member

Thanks @lukemanley

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Categorical Categorical Data Type Performance Memory or execution speed performance Reshaping Concat, Merge/Join, Stack/Unstack, Explode

2 participants