Back to Pandas

Find Substring

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

3.1.0.dev0358 B
Original Source

You can find the position of a character in a column of strings with the :meth:Series.str.find method. find searches for the first position of the substring. If the substring is found, the method returns its position. If not found, it returns -1. Keep in mind that Python indexes are zero-based.

.. ipython:: python

tips["sex"].str.find("ale")