Skip to content

Conversation

luke396
Copy link
Contributor

@luke396 luke396 commented Jan 17, 2023

It has mentioned some different values for factorize. This is the list:

pd.factorize(pd.Categorical(['a', 'a', 'c']))
pd.factorize(pd.Index(pd.Categorical(['a', 'a', 'b'])))
pd.factorize(pd.Series(pd.DatetimeIndex(['2017', '2017'], tz='US/Eastern')))
pd.factorize(pd.Series(pd.Categorical(['a', 'a', 'b'])))

For pd.factorize(pd.Categorical(['a', 'a', 'c'])), it has been test via REF/BUG/API: factorizing categorical data in pandas/tests/categorical/test_algos.py.

The rest are added here.

@mroeschke mroeschke added Testing pandas testing functions or related to the test suite Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Categorical Categorical Data Type labels Jan 17, 2023
@mroeschke mroeschke added this to the 2.0 milestone Jan 17, 2023
@mroeschke mroeschke merged commit 8d296f2 into pandas-dev:main Jan 17, 2023
@mroeschke
Copy link
Member

Thanks @luke396! Happy to see these unit testing issues getting addressed

@luke396 luke396 deleted the add_test_factorize_mixed_values branch January 18, 2023 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Categorical Categorical Data Type Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API: Should factorize(categorical) return a Categorical for uniques?
2 participants