Below is my DataFrame:
df = pd.DataFrame({'University':['4', '0', '3'],'Subject':['1', '2', '0']})
Just like 'University' & 'Subject' I have 50 other columns that end with the
column 'Score':['3', '1', '0'].
I would like to change the values for all 50 columns starting from the University all the way to Score. The condition should be if a value is => 1 then change them to 1 otherwise all other values should be zero.
I know that we are able to do it with this method:
df.loc[dt['University'] > 1] = 1
However, above I will have to type each and every one of my 50 columns. Is there a way where I could specifically mention starting from 'University' and ending at 'Score' which should include all the columns in between?
I am new to python so please try to be as clear as possible. Thank you.