I have a big data frame. I want to replace float 1.0 and 0.0 with the true and false.
My code:
import pandas as pd
df = pd.DataFrame({"A":[1.0,0.0,1.0,0.0]})
df.replace(1.0,True,inplace=True).replace(0.0,False,inplace=True)
Present output:
AttributeError: 'NoneType' object has no attribute 'replace'
If I do it separately in two lines, it will work. I want to do it in one line.