Skip to content

ENH/CLN: Add factorize to IndexOpsMixin #7090

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
May 10, 2014
Merged

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented May 10, 2014

As pointed in #7041, I prepared a PR to add factorize to IndexOpsMixin.

As a side benefit, Multiindex.from_arrays can preserve original DatetimeIndex.freq and tz. (Related to #3950 and #6606. These issues are not solved yet because these use different methods to create MultiIndex).

I would like to confirm following points before adding more tests.

  • What Index.factorize and Series.factorize should return as unique values, ndarray or Index? I think it should return Index to preserve DatetimeIndex attributes (freq and tz).
  • Is this should be added to api.rst?

@jreback
Copy link
Contributor

jreback commented May 10, 2014

this seems reasonable; factorize for a Index/Series should return an Index (of course using it on an ndarray just returns an ndarray). So the api is preservered. You can add it to the api.rst for completeness.

@jreback jreback added this to the 0.14.0 milestone May 10, 2014
@jreback
Copy link
Contributor

jreback commented May 10, 2014

rebase 1 more time (I think just rlease notes conflict then good to go)

jreback added a commit that referenced this pull request May 10, 2014
ENH/CLN: Add factorize to IndexOpsMixin
@jreback jreback merged commit 76dd27f into pandas-dev:master May 10, 2014
@jreback
Copy link
Contributor

jreback commented May 10, 2014

@sinhrks thanks!

@sinhrks
Copy link
Member Author

sinhrks commented May 10, 2014

@jreback Thanks to merge. Added more tests and added descriptions to api.rst

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Categorical Categorical Data Type Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants