Skip to content

Commit

Permalink
Slighly better label docs and move to analytics module
Browse files Browse the repository at this point in the history
  • Loading branch information
wesm committed May 31, 2015
1 parent abb8797 commit ee037d6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
18 changes: 18 additions & 0 deletions ibis/expr/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,21 @@ def histogram(arg, nbins=None, binwidth=None, base=None, closed='left',
op = Histogram(arg, nbins, binwidth, base, closed=closed,
aux_hash=aux_hash)
return op.to_expr()


def category_label(arg, labels, nulls=None):
"""
Format a known number of categories as strings
Parameters
----------
labels : list of string
nulls : string, optional
How to label any null values among the categories
Returns
-------
string_categories : string value expression
"""
op = CategoryLabel(arg, labels, nulls)
return op.to_expr()
14 changes: 1 addition & 13 deletions ibis/expr/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,21 +768,9 @@ def _string_dunder_contains(arg, substr):
# ----------------------------------------------------------------------
# Category API

def _category_label(arg, labels, nulls=None):
"""
Parameters
----------
labels : list of string
nulls : string, optional
How to label any null values among the categories
"""
op = _analytics.CategoryLabel(arg, labels, nulls)
return op.to_expr()


_category_value_methods = dict(
label=_category_label
label=_analytics.category_label
)

_add_methods(CategoryValue, _category_value_methods)
Expand Down

0 comments on commit ee037d6

Please sign in to comment.