Skip to content
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

StringMethods should have the same methods as standard str #9111

Closed
24 tasks done
sinhrks opened this issue Dec 20, 2014 · 6 comments
Closed
24 tasks done

StringMethods should have the same methods as standard str #9111

sinhrks opened this issue Dec 20, 2014 · 6 comments
Labels
API Design Strings String extension data type and string data
Milestone

Comments

@sinhrks
Copy link
Member

sinhrks commented Dec 20, 2014

Should StringMethods be compatible with standard str, or have only useful methods? Sometimes I have to adjust text formats before converting other types, and I've chosen additionals which makes formatting / adjustments easier. Any ideas?

NOTE For python 2.x, once convert target to unicode internally then call the func.

Which may not be very userful:

  • expandtabs
  • splitlines

I think there is an option to implement these to say "support the same methods as standard str".

@sinhrks
Copy link
Member Author

sinhrks commented Feb 1, 2015

Added unicode.isnumeric and unicode.isdecimal to the list.

@sinhrks
Copy link
Member Author

sinhrks commented Feb 15, 2015

Would like to discuss an additional:

  • Unicode normalization

    unicodedata.normalize is quite useful to standardize multi-bytes characters. I think it is nice if StringMethods.normalize can perform this.

    import pandas as pd
    s = pd.Series([u'ABCDE', u'12345'])
    s
    # 0    ABCDE
    # 1    12345
    # dtype: object
    
    s.str.normalize()
    # 0    ABCDE
    # 1    12345
    # dtype: object
    

@sinhrks
Copy link
Member Author

sinhrks commented Jun 6, 2015

The last remaining is str.rsplit. Even though split supports both str and regex, I think there is no easy way (and use case) to rsplit with regex. How about implement str.rsplit only for str and closig this.

CC @mortada

@mortada
Copy link
Contributor

mortada commented Jun 6, 2015

@sinhrks that sounds reasonable. I'm happy to do a PR for this.

@jreback jreback modified the milestones: 0.16.2, Next Major Release Jun 9, 2015
@jreback
Copy link
Contributor

jreback commented Jun 9, 2015

looks like this is finished!

awesome job @sinhrks, cc @mortada

@jreback jreback closed this as completed Jun 9, 2015
@sinhrks
Copy link
Member Author

sinhrks commented Jun 9, 2015

Thanks, @mortada !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Strings String extension data type and string data
Projects
None yet
Development

No branches or pull requests

3 participants