import pandas as pd
data = [['Alex',10],['Bob',12],['Clarke',13] ['Adam', 14]]
df = pd.DataFrame(data,columns=['Name','Age'])
print(df)
Name Age
0 Alex 10
1 Bob 12
2 Clarke 13
3 Adam 14
I want to get only Names starting with A . I tried following code mask = df['Name'].str.contains("A*")
mask
0 True
1 True
2 True
Name: Name, dtype: bool
df = df[mask]
Name Age
0 Alex 10
1 Bob 12
2 Clarke 13
but I want to get the result as Name Age
0 Alex 10