Replacing column name in pandas dataframe

  pandas, python, replace

I am trying to rename a column name with another. However i get a red mark at the end of this line. Does anybody know what could have gone wrong?

df.rename(columns={'oldname': 'newname'}, inplace=True)
df["NewKey"] = df["key"] + df["name"]

I receive a syntax error in pycharm when executing the above code..

Source: Python Questions