'Pandas DataFrame .attrs is not saved when saving dataframe with to_csv method

I'm using pandas df.attrs method to store metadata in dataframes. Unfortunately those are never saved when I use to_arbitrary_type('filepath') methods. Can someone tell me the correct way to save dataframes such that the df.attrs get saved too?

Thank you!



Solution 1:[1]

You cannot save metadata of a dataframe in any file type. You can do so with HD5, as presented here.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Benjamin Rio