-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLN: Refactor string special methods to common decorator + safe unicode everywhere #4090
Comments
I had this change in my refactor of series - but u r welcome to do separately should be a top level pandas base class ( really should be PandasObject but that is used now) that PandasObject, NDFrame, Index and such inherit from with methods like this |
One problem is that core/generic imports MultiIndex...should the baseclass go in a different file to avoid the circular import? |
should be like a mix-in I think Index makes sense as well here On Jun 30, 2013, at 8:41 PM, Jeff Tratner notifications@github.com wrote:
|
Okay, should be totally simple to adapt. |
yes maybe core/base.py ? |
@jreback haha, I had just starting editing core/base right before I saw your note. |
@jreback we could rename |
that works |
FYI there are also some other public objects that prob should inherit from this as well Categorical, HDFStore (maybe) others I am sure |
Yeah, I'd caught those. Covered by Series, Frame and Panel via On Sun, Jun 30, 2013 at 8:57 PM, jreback notifications@github.com wrote:
|
there be a real base class mixin shouldn't be too complicated |
@jreback what? Slightly confused. I was thinking fo: class StringMixin(object): # adds string methods
class PandasObject(StringMixin) # baseclass for Index, Categorical, PandasContainer, etc.
class PandasContainer(PandasObject): # baseclass for NDFrame |
yep that's good first 2 in core/base 3rd replaces current PandasObject def |
I was implementing some new objects for another PR and noticed that string methods are duplicated throughout (particularly on objects that don't inherit from each other). Wrote this up on this branch - https://github.com/jtratner/pandas/tree/refactor_string_magic_methods .
If you thing this is worthwhile, I'll split it up a little, add a bit better documentation and submit.
This is used multiple times:
Unicode tends to vary, but often is like this:
Additionally, a number of objects aren't using a unicode-safe representation of themselves, so this would resolve that as well. Would this be useful to include?
The text was updated successfully, but these errors were encountered: