Python With Excel and Text Strings
Pandas Dataframes
Let’s add a new column to an already existing pandas dataframe
Code:
import pandas as pd
df = pd.read_excel('europe_cities_by_sunshine.xlsx')
df['City and Country'] = df['City'] + ', ' + df['Country']
Explanation:
We created a new column and assigned it to be the combination of the data in the City and Country columns, with a comma in the middle.