I am trying to convert columns from multiple dataframes to boolean. What I have written to convert them is the following:
for i in range(0,4):
df[i][['Col1','Col2','Col3','Col4']].astype('bool')
However it does not convert anything. Not all the columns from the dataframes need to be converted to boolean, so I have selected above only those ones that need to be converted.
When I print df[1].dtypes (but I get the same results also from the other dataframes), all the columns above are objects, not boolean.
Could you please tell me where the error is in my code?