I have a very simple for loop which was working last week but when I run it this week on exactly the same data it is not working... when I run the code outside of the loop it works without an error. I don't understand...
The code is: '''
survey = pd.read_csv(folderin + 'survey.csv')
CSsurvey = pd.read_csv(folderin + 'CS_survey.csv')
sports = ['Value MTB related (e.g. inner tubes, water bottles etc)',
'Value Running','Value Roaming and other outdoor related (e.g. climbing, kayaking)',
'Value Outdoor sports event related (e.g.race)']
sport = []
for p in sports:
item = survey[p].sum()
CSitem = CSsurvey[p].sum()
total = item + CSitem
sport.append(total)'''
I get the error:
If I run the code for each 'p' outside of the loop I don't get an error


sport = pd.concat([survey, CSurvey]).sum(axis=0)[sports].to_list()