Presidentes_archivo = pd.read_csv('us_presidents 2.csv')
Presidentes_archivo.head()
Presidentes_nombres = pd.Series(Presidentes_archivo['president'])
Presidentes_nombres
0 George Washington
1 John Adams
2 Thomas Jefferson
3 James Madison
4 James Monroe
5 John Quincy Adams
Presidentes_nombres.str.upper()
0 GEORGE WASHINGTON
1 JOHN ADAMS
2 THOMAS JEFFERSON
3 JAMES MADISON
4 JAMES MONROE
5 JOHN QUINCY ADAMS
Presidentes_nombres.str.len()
0 17
1 10
2 16
3 13
4 12
5 17
Presidentes_nombres.str.lower()
0 george washington
1 john adams
2 thomas jefferson
3 james madison
4 james monroe
5 john quincy adams
Presidentes_nombres[Presidentes_nombres.str.startswith(pat='J') ]
1 John Adams
3 James Madison
4 James Monroe
5 John Quincy Adams
9 John Tyler
import re
Presidentes_nombres[~Presidentes_nombres.str.contains(pat='Bill|Calvin', regex=True)]# si se pone True, se asume que es una regular expression
Presidentes_nombres.str.replace(pat='Calvin',repl=' ',)
0 George Washington
1 John Adams
2 Thomas Jefferson
3 James Madison
4 James Monroe
5 John Quincy Adams