In a specific data set, I have a column, 'starCustomer', that takes on these values:
[0, X, 0, 0, X, 0, X,...]
That is, each observation will contain a 0 if the person is not a Star Customer, but an X if that person is. I thought it would be a better idea to represent each X as 1 instead, so, I wrote the following code:
Star = df['starCustomer']
New_Star = [1 if x == 'X', else 0 for x in Star]
However, it is to my knowledge that New_Star is not a data frame, as we want it to be. So, I try to execute this following code:
Star = pd.DataFrame(New_Star)
However, I get the following error:
TypeError: 'list' object is not callable
Can anybody inform me on what's incorrect about this?
Staris not a DataFrame either. It is a Series.