Skip to content
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

PEFR/BUG/API: rename_categories with a series #17981

Closed
TomAugspurger opened this issue Oct 25, 2017 · 2 comments
Closed

PEFR/BUG/API: rename_categories with a series #17981

TomAugspurger opened this issue Oct 25, 2017 · 2 comments
Labels
API Design Bug Categorical Categorical Data Type Performance Memory or execution speed performance
Milestone

Comments

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Oct 25, 2017

In [2]: pd.Categorical(['a', 'b']).rename_categories(pd.Series([0, 1]))
Out[2]:
[a, b]
Categories (2, object): [a, b]

In 0.20.3 that was

[0, 1]
Categories (2, int64): [0, 1]
In [9]:

Do we want to treat series like an array or a dictionary here?

(this is causing the perf slowdown in rank I think).

@TomAugspurger TomAugspurger added API Design Bug Categorical Categorical Data Type Performance Memory or execution speed performance labels Oct 25, 2017
@TomAugspurger
Copy link
Contributor Author

xref #17586 implementing the dict-like rename.

@TomAugspurger TomAugspurger added this to the 0.21.0 milestone Oct 25, 2017
TomAugspurger added a commit to TomAugspurger/pandas that referenced this issue Oct 25, 2017
HEAD:

```
[ 50.00%] ··· Running categoricals.Categoricals3.time_rank_string_cat          6.63ms
[ 50.00%] ·····
[100.00%] ··· Running categoricals.Categoricals3.time_rank_string_cat_ordered  4.85ms
```

Closes pandas-dev#17981
@TomAugspurger
Copy link
Contributor Author

I made #17982 assuming we want to use treat series as an array-like. I think that's the right move here, for backwards compat, but it's a bit unfortunate to have to special case it here.

jreback pushed a commit that referenced this issue Oct 26, 2017
* PERF/API: Treat series as array-like for rename_categories

HEAD:

```
[ 50.00%] ··· Running categoricals.Categoricals3.time_rank_string_cat          6.63ms
[ 50.00%] ·····
[100.00%] ··· Running categoricals.Categoricals3.time_rank_string_cat_ordered  4.85ms
```

Closes #17981

* Redo docstring

* Use list-like

* Warn

* Fix doc indent

* Doc cleanup

* More doc cleanup

* Fix API reference

* Typos
peterpanmj pushed a commit to peterpanmj/pandas that referenced this issue Oct 31, 2017
* PERF/API: Treat series as array-like for rename_categories

HEAD:

```
[ 50.00%] ··· Running categoricals.Categoricals3.time_rank_string_cat          6.63ms
[ 50.00%] ·····
[100.00%] ··· Running categoricals.Categoricals3.time_rank_string_cat_ordered  4.85ms
```

Closes pandas-dev#17981

* Redo docstring

* Use list-like

* Warn

* Fix doc indent

* Doc cleanup

* More doc cleanup

* Fix API reference

* Typos
No-Stream pushed a commit to No-Stream/pandas that referenced this issue Nov 28, 2017
* PERF/API: Treat series as array-like for rename_categories

HEAD:

```
[ 50.00%] ··· Running categoricals.Categoricals3.time_rank_string_cat          6.63ms
[ 50.00%] ·····
[100.00%] ··· Running categoricals.Categoricals3.time_rank_string_cat_ordered  4.85ms
```

Closes pandas-dev#17981

* Redo docstring

* Use list-like

* Warn

* Fix doc indent

* Doc cleanup

* More doc cleanup

* Fix API reference

* Typos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Bug Categorical Categorical Data Type Performance Memory or execution speed performance
Projects
None yet
Development

No branches or pull requests

1 participant