CLN/DOC/TST: categorical fixups (GH7768) #8006
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 levelsare 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