Python With Excel and Text Strings
Pandas Dataframes
The isin() keyword can make life easier if there are many conditions to include
Code:
import pandas as pd
df = pd.read_excel('europe_cities_by_sunshine.xlsx')
df[ (df['Country'].isin(['France','Greece']) ) ]
Explanation:
The isin() keyword is very useful if say we’d like 10 countries to include, then we don’t need to do df[‘Country‘] == ‘Spain‘ 10 times for 10 different countries.