Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
API: Add str/dt accessors to categorical #10661
Comments
sinhrks
added Timeseries API Design Categorical
labels
Jul 23, 2015
sinhrks
added this to the
0.17.0
milestone
Jul 23, 2015
|
xref to #8627 What you are saying is the should ALSO allow the dtype correct accessor for its values (or categories if its a Categorical), in addition to the |
jreback
modified the milestone: Next Major Release, 0.17.0
Aug 20, 2015
jreback
added Prio-high Difficulty Intermediate Effort Medium
labels
Aug 20, 2015
|
So, what this should do is simple allow the |
|
One solution (for
|
|
@janschulz not at all. This needs to operate on the categories, then return a new categorical object that has (transformed values).
|
|
ok, on it... |
|
Ok, what should that return:
-> a series of type string/object or a series of type category where the categories are of dtype str (and transformed)? I would go for the first, as it would honor the contract for str, which says it's a string: from http://pandas.pydata.org/pandas-docs/stable/api.html#string-handling
|
|
@janschulz , no I would change the docs. The point of using a |
|
This is slightly more tricky though (and its actually an example where it is quite useful). Note that [123] as I show below is actually pretty inefficient, as I already know the indexers. I think we can compute that directly.
|
|
I really hate that argument: "The point of using a category dtype is that it essentially acts like its object cousin, but is simply more efficient". Can't we get a |
|
Ok, found a case where it should not result in a category:
|
|
Another problem if we would return a category: should it be ordered or not? |
janschulz
referenced
this issue
Nov 12, 2015
Closed
Make .str/.dt available for Series of type category with string/datetime #11582
|
Ok, I have PR which returns normal Series (not categories) so that you can concat substrings ( |
|
I don't think we should try to return categorical here. There are way too many cornercases in all of the string manipulation functions to deal with which are all a bit subjective. Eg what to do with |
|
I think the concatenation of strings with |
|
@jorisvandenbossche |
|
ah, sorry, I misread your comment above that you wanted to do |
|
@jorisvandenbossche jep, exactly: if |
jreback
referenced
this issue
Nov 13, 2015
Closed
PERF: perform .str operations on categoricals #8627
jreback
modified the milestone: 0.17.1, Next Major Release
Nov 17, 2015
|
closed by #11582 |
sinhrks commentedJul 23, 2015
Accessors should be enabled depending on
categories. Should careCategoricalIndexalso.