concept string in category pandas

appears as: strings, string, The string, string, strings, A string
Pandas in Action

This is an excerpt from Manning's book Pandas in Action.

The index of the DataFrame can also be filtered. Pandas ships with many helper methods for working with strings. In the example below, we transform the movie titles in the index to lowercase characters and then find all movies with the word dark in the title.

A string is a collection of zero or more text characters. We declare a string by wrapping a piece of text in a pair of single, double, or triple quotes. There are differences between the three options, but they are largely insignificant for beginners. We'll be sticking with double quotes throughout the book. Jupyter Notebook's output for the three options will be identical.

In [4] 'Good morning'
Out [4] 'Good morning'
In [5] "Good afternoon"
Out [5] 'Good afternoon'
In [6] """Good night"""
Out [6] 'Good night'

Strings are not just limited to alphabetic characters; they can include digits, spaces and symbols. In addition to the 7 alphabetic characters in "dollars", the string below includes a dollar sign, two digits, a space, and an exclamation point.

In [7] "$15 dollars!"
Out [7] '$15 dollars!'

Use the presence of quotes as a visual identifier for a string. Many beginners are confused by a value like "5", which is a string even though it holds a numeric character.