Pandas .str.get: Retrieving characters from string columns

Pandas .str.get: Retrieving characters from string columns

Want to retrieve from a string column in your Python Pandas data frame? Use .str.get:

df['a'].str.get(0)  # one character
df['a'].str.get(i)  # using an index variable

But wait: You can use [], in place of .get:

df['a'].str[0] # alt syntax!