#This syntax shows how to select all rows of the DataFrame that contain the values 25, 9
#in any of the columns:
df[df.isin([25, 9]).any(axis=1)]
import pandas as pd
data = {'Month': ['January','February','March','April','May','June','July','August','September','October','November','December'],
'Days in Month': [31,28,31,30,31,30,31,31,30,31,30,31]
}
df = pd.DataFrame(data, columns = ['Month', 'Days in Month'])
contain_values = df[df['Month'].str.contains('Ju')]
print (contain_values)
# For columns of string elements, searching if it contains the word.
# Case insensitive
df.loc[df['column_name'].str.contains("search_word", case=False)]
import pandas as pd
data = {'Month': ['January','February','March','April','May','June','July','August','September','October','November','December'],
'Days in Month': [31,28,31,30,31,30,31,31,30,31,30,31]
}
df = pd.DataFrame(data, columns = ['Month', 'Days in Month'])
contain_values = df[df['Month'].str.contains('Ju')]
print (contain_values)