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

chore: remove ak.to_categorical #2779

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/redirects.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"_auto/ak.to_arrow.any-ext": "../reference/generated/ak.to_arrow.html",
"_auto/ak.to_arrow_table.any-ext": "../reference/generated/ak.to_arrow_table.html",
"_auto/ak.to_buffers.any-ext": "../reference/generated/ak.to_buffers.html",
"_auto/ak.to_categorical.any-ext": "../reference/generated/ak.to_categorical.html",
"_auto/ak.to_categorical.any-ext": "../reference/generated/ak.str.to_categorical.html",
"_auto/ak.to_cupy.any-ext": "../reference/generated/ak.to_cupy.html",
"_auto/ak.to_jax.any-ext": "../reference/generated/ak.to_jax.html",
"_auto/ak.to_json.any-ext": "../reference/generated/ak.to_json.html",
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/toctree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@
.. toctree::
:caption: Arrays of categorical data

generated/ak.to_categorical
generated/ak.from_categorical
generated/ak.is_categorical
generated/ak.categories
generated/ak.str.to_categorical

.. toctree::
:caption: Indexing and grouping
Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/how-to-create-strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ Categorical strings

A large set of strings with few unique values are more efficiently manipulated as integers than as strings. In Pandas, this is [categorical data](https://pandas.pydata.org/pandas-docs/stable/user_guide/categorical.html), in R, it's called a [factor](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/factor), and in Arrow and Parquet, it's [dictionary encoding](https://arrow.apache.org/blog/2019/09/05/faster-strings-cpp-parquet/).

The {func}`ak.to_categorical` function makes Awkward Arrays categorical in this sense. {func}`ak.to_arrow` and {func}`ak.to_parquet` recognize categorical data and convert it to the corresponding Arrow and Parquet types.
The {func}`ak.str.to_categorical` (requires PyArrow) function makes Awkward Arrays categorical in this sense. {func}`ak.to_arrow` and {func}`ak.to_parquet` recognize categorical data and convert it to the corresponding Arrow and Parquet types.

```{code-cell} ipython3
uncategorized = ak.Array(["three", "one", "two", "two", "three", "one", "one", "one"])
uncategorized
```

```{code-cell} ipython3
categorized = ak.to_categorical(uncategorized)
categorized = ak.str.to_categorical(uncategorized)
categorized
```

Expand Down
1 change: 0 additions & 1 deletion src/awkward/operations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
from awkward.operations.ak_to_arrow_table import *
from awkward.operations.ak_to_backend import *
from awkward.operations.ak_to_buffers import *
from awkward.operations.ak_to_categorical import *
from awkward.operations.ak_to_cupy import *
from awkward.operations.ak_to_dataframe import *
from awkward.operations.ak_to_feather import *
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def categories(array, highlevel=True):
#ak.contents.IndexedOptionArray labeled with parameter
`"__array__" = "categorical"`), then this function returns its categories.

See also #ak.is_categorical, #ak.to_categorical, #ak.from_categorical.
See also #ak.is_categorical, #ak.str.to_categorical, #ak.from_categorical.
"""
# Dispatch
yield (array,)
Expand Down
3 changes: 1 addition & 2 deletions src/awkward/operations/ak_from_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def from_categorical(array, *, highlevel=True, behavior=None):
size of the dataset. (Conversion to categorical is expensive; conversion
from categorical is cheap.)

See also #ak.is_categorical, #ak.categories, #ak.to_categorical,
#ak.str.to_categorical, #ak.from_categorical.
See also #ak.is_categorical, #ak.categories, #ak.str.to_categorical.
"""
# Dispatch
yield (array,)
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_is_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def is_categorical(array):
`"__array__" = "categorical"`), then this function returns True;
otherwise, it returns False.

See also #ak.categories, #ak.to_categorical, #ak.from_categorical.
See also #ak.categories, #ak.str.to_categorical, #ak.from_categorical.
"""
# Dispatch
yield (array,)
Expand Down
160 changes: 0 additions & 160 deletions src/awkward/operations/ak_to_categorical.py

This file was deleted.

Loading