I have multiindex dataframe that is actually an attribute and I am looking to store the index names using the following command:
getattr(self, attrdfname).__idxnames__ = getattr(self, attrdfname).index.names
It raises the following error:
UserWarning: Pandas doesn't allow columns to be created via a new attribute name
Found some answers around but it's not very clear how I could avoid the warning.
I could obviously call the below command whenever I need it but as I have several dataframes stored as attributes, I would like to store these dataframes 'attributes' to my dataframe.
getattr(self, attrdfname).index.names
Anyone knows how to work around it?