Back to Pandas

Extract Substring

doc/source/getting_started/comparison/includes/extract_substring.rst

3.1.0.dev0194 B
Original Source

With pandas you can use [] notation to extract a substring from a string by position locations. Keep in mind that Python indexes are zero-based.

.. ipython:: python

tips["sex"].str[0:1]