clicks_pivot['percent_clicked'] = clicks_pivot[True] / (clicks_pivot[False] + clicks_pivot[True])
´´´
So, why can't I use clicks_pivot.True instead of clicks_pivot[True]?
Thanks in advance
The fact that the dotted attribute allows you to access columns is more of a convenience tool implemented by pandas (the real access method is via [colname]). There are also certain column names that can never be accessed by the . attribute syntax (this includes most dataframe/series methods and also includes certain python keywords/disallowed identifier names like True). So if you really want a column addressed by True you’d need to access it with df[True] as df.True will always throw an error.