1.以xxx开头
# 方法1:endswith函数
df[df.num.str.endswith('o')]
# 方法2:contains函数+正则表达式
df[df.num.str.contains('o$')]
# 方法3:query函数
df.query("num.str.endswith('o')",engine='python')
2.以XXX结尾
# 方法1:endswith函数
df[df.num.str.endswith('o')]
# 方法2:contains函数+正则表达式
df[df.num.str.contains('o$')]
# 方法3:query函数
df.query("num.str.endswith('o')",engine='python')
3.包含XXX的
# 方法1:contains函数+正则表达式
df[df.num.str.contains('o')]
# 方法2:query函数
df.query("num.str.contains('o')",engine='python')