how to extract dataframe column with spaces in between

movie_list = [{‘Goodfellas’: 4.5, ‘Raging Bull’: 3.0, ‘Roman Holiday’: np.nan,‘The Apartment’: 1.0},
{‘Goodfellas’: 2.0, ‘Raging Bull’: 1.0, ‘Roman Holiday’: 4.5, ‘The Apartment’: 5.0}]

movie_data.loc[movie_data.The Apartment.isin([5,1]),[“Goodfellas”,“The Apartment”]] = “Sidddddd”

Above line is not working, But below one works good
movie_data.loc[movie_data.Goodfellas.isin([4.5,2]),[“Goodfellas”,“The Apartment”]] = “Sid”

The reason the first line of code is not working is due to incorrect syntax when accessing a column in a DataFrame. The correct syntax is to use square brackets [] and quote the column name as a string, like movie_data['The Apartment'].

In the second line of code, the column "Goodfellas" is being accessed correctly, which is why the code is working as expected.

So, the corrected code would be:
movie_data.loc[movie_data[‘The Apartment’].isin([5,1]),[“Goodfellas”,“The Apartment”]] = “Sidddddd”