I have a very large dataframe where only the first two columns are not bools. However everything is brought in as a string due to the source. The True/False fields do contain actual blanks (not nan) as well and are spelled out 'True' and 'False'
I'm trying to come up with a dynamic-ish way to do this without typing out or listing every column.
ndf.iloc[:,2:].astype(bool)
That seems to at least run and change it to bool, but when I add 'inplace=True' it has no effect at storing the property types. I've also tried the code below to no luck. It runs but doesn't actually do anything that I can tell.
ndf.iloc[:,2:] = ndf.iloc[:,2:].astype(bool)
I need to be able to write this table back into a database as 0s and 1s ultimately. I'm not the most versed at bools and am hoping there is an easy one liner way to do this that I don't know yet.