Series.str.partition(pat=' ', expand=True) [source]
Split the string at the first occurrence of sep, and return 3 elements containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return 3 elements containing the string itself, followed by two empty strings.
| Parameters: |
pat : string, default whitespace String to split on. expand : bool, default True
|
|---|---|
| Returns: |
|
See also
rpartition
sep
>>> s = Series(['A_B_C', 'D_E_F', 'X']) 0 A_B_C 1 D_E_F 2 X dtype: object
>>> s.str.partition('_')
0 1 2
0 A _ B_C
1 D _ E_F
2 X
>>> s.str.rpartition('_')
0 1 2
0 A_B _ C
1 D_E _ F
2 X
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
http://pandas.pydata.org/pandas-docs/version/0.23.4/generated/pandas.Series.str.partition.html