def value_counts(values, sort=True, ascending=False, normalize=False,<EOL>bins=None, dropna=True):
from pandas.core.series import Series, Index<EOL>name = getattr(values, '<STR_LIT:name>', None)<EOL>if bins is not None:<EOL><INDENT>try:<EOL><INDENT>from pandas.core.reshape.tile import cut<EOL>values = Series(values)<EOL>ii = cut(values, bins, include_lowest=True)<EOL><DEDENT>except TypeError:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>result = ii.value_counts(dropna=dropna)<EOL>result = result[result.index.notna()]<EOL>result.index = result.index.astype('<STR_LIT>')<EOL>result = result.sort_index()<EOL>if dropna and (result.values == <NUM_LIT:0>).all():<EOL><INDENT>result = result.iloc[<NUM_LIT:0>:<NUM_LIT:0>]<EOL><DEDENT>counts = np.array([len(ii)])<EOL><DEDENT>else:<EOL><INDENT>if is_extension_array_dtype(values) or is_sparse(values):<EOL><INDENT>result = Series(values)._values.value_counts(dropna=dropna)<EOL>result.name = name<EOL>counts = result.values<EOL><DEDENT>else:<EOL><INDENT>keys, counts = _value_counts_arraylike(values, dropna)<EOL>if not isinstance(keys, Index):<EOL><INDENT>keys = Index(keys)<EOL><DEDENT>result = Series(counts, index=keys, name=name)<EOL><DEDENT><DEDENT>if sort:<EOL><INDENT>result = result.sort_values(ascending=ascending)<EOL><DEDENT>if normalize:<EOL><INDENT>result = result / float(counts.sum())<EOL><DEDENT>return result<EOL>
Compute a histogram of the counts of non-null values.

Parameters
----------
values : ndarray (1-d)
sort : boolean, default True
    Sort by values
ascending : boolean, default False
    Sort in ascending order
normalize: boolean, default False
    If True then compute a relative histogram
bins : integer, optional
    Rather than count values, group them into half-open bins,
    convenience for pd.cut, only works with numeric data
dropna : boolean, default True
    Don't include counts of NaN

Returns
-------
value_counts : Series