Closed CiaraShortiss closed 4 years ago
It looks like it is running everything line by line rather than as a single block when you highlight it and press F9
try wrapping the code in #%% Like this, then pressing ctrl+enter
#%%
first = pd.DataFrame({'Experiment': ['1', '2', '3', '4'],
'Control_1': ['30', '45', '40', '40'],
'Treatment_1': ['3', '4', '3', '2']})
second = pd.DataFrame({'Experiment': ['1', '2', '3', '4'],
'Control_2': ['32', '36', '42', '45'],
'Treatment_2': ['30', '28', '37', '42']})
#%%
I was working my way through the notes on 'Merging two dataframes based on a common column' (one of the last sections in the Pandas notes). The first thing you gave code for was to create two new date frames (that then we were going to merge). I have copied and pasted the code you wrote directly into my script and I keep getting this syntax error (first screen shot below, highlighted code is what I just ran).
I have taken out the curly brackets, played around with all types of brackets in all the different places you can have brackets, I changed the string number to integers by taking out the ' ', nothing worked the syntax error seemed to just move around.
I then went back to code that worked yesterday to create a data frame (again this is code I copied and pasted from the notes), and now that doesn't work either!! It also gives a syntax error (see below).
It just doesn't seem to like creating data frames anymore. What is going on!?