CLN/DOC/TST: categorical fixups (GH7768) by jreback · Pull Request #8006 · pandas-dev/pandas (original) (raw)
replaces #7768
closes #3678
Categorical([1, np.nan]) would end up with a single 1.
float level.
This commit ensures that if values
is a list of ints and contains np.nan,
the float conversation does not take place.
Categorical: fix describe with np.nan
Categorical: ensure that one can assign np.nan
Categorical: fix assigning NaN if NaN in levels
API: change default Categorical.from_codes() to ordered=False
In the normal constructor ordered=True
is only assumed if the levels
are given or the values are sortable (which is most of the cases), but
in from_codes(...)
we can't asssume this so the default should beFalse
.
Categorical: add some links to Categorical in the other docs
Categorical: use s.values when calling private methods
s.values is the underlying Categorical object, s.cat will be changed
to only expose the API methods/properties.
Categorical: Change series.cat to only expose the API
Categorical: Fix order and na_position
Categorical: Fix comparison of Categoricals and Series|Categorical|np.array
Categorical can only be comapred to another Categorical with the same levels
and the same ordering or to a scalar value.
If the Categorical has no order defined (cat.ordered == False), only equal
(and not equal) are defined.
DOC: use okexcept in docs rather than try: except:
CLN: revised isnull treatement
TST: test for tab completion