Skip to content

Commit fc4f1bd

Browse files
committed
DOC: str.split to use return_type in an example
1 parent ea1c501 commit fc4f1bd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

doc/source/text.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ Methods like ``split`` return a Series of lists:
4242
s2 = Series(['a_b_c', 'c_d_e', np.nan, 'f_g_h'])
4343
s2.str.split('_')
4444
45-
Easy to expand this to return a DataFrame
45+
Elements in the split lists can be accessed using ``get`` or ``[]`` notation:
4646

4747
.. ipython:: python
4848
49-
s2.str.split('_').apply(Series)
49+
s2.str.split('_').str.get(1)
50+
s2.str.split('_').str[1]
5051
51-
Elements in the split lists can be accessed using ``get`` or ``[]`` notation:
52+
Easy to expand this to return a DataFrame using ``return_type``.
5253

5354
.. ipython:: python
5455
55-
s2.str.split('_').str.get(1)
56-
s2.str.split('_').str[1]
56+
s2.str.split('_', return_type='frame')
5757
5858
Methods like ``replace`` and ``findall`` take `regular expressions
5959
<https://docs.python.org/2/library/re.html>`__, too:

0 commit comments

Comments
 (0)