DiMateo
DiMateo

Reputation: 11

Syntax error in renaming columns in dataframe

I am trying to rename the columns below with the code also below but i keep getting a syntax error.

clean_data_dummies.rename(columns={'Indication_a-f': 'a-f', 'Indication_cva': 'cva','Indication_tia':'tia','Diabetes_yes':'Diabetes','IHD_yes':'IHD','Hypertension_yes':'Hypertension','Arrhythmia_yes':'Arrhythmia','History_yes','History','label_Risk':'Risk'},inplace=True)

Upvotes: 0

Views: 752

Answers (1)

Paul Lo
Paul Lo

Reputation: 6148

There is a typo in your dictionary, you should convert a , to : as shown below:

'History_yes':'History'

Most of IDE should highlight the syntax mistakes for you by default, hope you are able to find it

Upvotes: 1

Related Questions