Python With Excel and Text Strings
Pandas Dataframes
See below how easy it is to save a filtered dataframe to Excel
Code:
import pandas as pd
df = pd.read_excel('europe_cities_by_sunshine.xlsx')
sub_df = df[df['Country'].isin(['France'])]
sub_df.to_csv(f'France_Rankings_By_Sun.csv', index=False)
Explanation:
We’re filtering for only France cities, and the using the to_csv() function to save this csv file locally.