When I try to rename and drop columns from pandas data.frame I'm experiencing an error saying >AttributeError: 'NoneType' object has no attribute 'drop'.
Pandas df.rename.drop.groupby.reset_index order is always confuses me. What is the correct syntax I should be following when want to reshape the pandas df ?
raw_data = {'patient': [1, 1, 1, 2, 2],
        'obs': [1, 2, 3, 1, 2],
        'treatment': [0, 1, 0, 1, 0],
        'score': ['strong', 'weak', 'normal', 'weak', 'strong'],    
        'tr': [1,2,3,4,5],
        'tk': [6,7,8,9,10],
        'ak': [11,12,13,14,15]
        }
df = pd.DataFrame(raw_data, columns = ['patient', 'obs', 'treatment', 'score','tr','tk','ak'])
df
   patient  observation  treatment Dr_score  tr  tk  ak
0        1            1          0   strong   1   6  11
1        1            2          1     weak   2   7  12
2        1            3          0   normal   3   8  13
3        2            1          1     weak   4   9  14
4        2            2          0   strong   5  10  15
def rename_drop(df):
    df=df.rename(columns = {'obs':'observation', 'score':'Dr_score'},inplace = True).drop('tk',axis=1,inplace=True)
    return df
rename_drop(df)
AttributeError: 'NoneType' object has no attribute 'drop'
 
    