From Kaggle I downloaded some data about LaLiga (and its results) throughout the years. There´s a column named 'Score' (for instance: 1-1) and I want to create a new column called 'Total Goals'. As I try to apply my beginner pandas skills, the only thing I manage to pop up is a column with the value 'NaN'
df['Total Goals'] = df['Score'].apply(lambda x: x.split('-'))
df['Total Goals'] = pd.to_numeric(df['Total Goals'], errors='coerce')
df['Total Goals'] = df['Total Goals'][0]+ df['Total Goals'][1]
df.head()
Unfortunately I couldn´t figure out the exact issue and now want to ask you where the problem is.