Python statsmodels – ValueError: how to create variable in range 0 to 1?

Python statsmodels – ValueError: how to create variable in range 0 to 1?

这已经完成并撒上灰尘

你能试试这个吗?

sacramento["baths"] = sacramento["baths"].apply(lambda x: 0 if x== 1 else 1)