I want to attach some meta data with a pandas dataframe. The meta data is like adding some description about what all data processing was done before saving the dataframe.
I came across this solution: https://stackoverflow.com/a/52546933/214526
So, I have tried followings:
xarrDS: xarray.Dataset = pdDF.to_xarray()
xarrDS.attrs["description"] = "Some description about data processing"
## here if I display xarrDS in the notebook, it shows the data correctly"
xarrDS.to_netcdf(path="processed_df.nc")
But this save to netcdf causes this exception:
ValueError: setting an array element with a sequence
The pandas dataframe does not have any NaN values. I do not find any relevant solutions online. I see that this article also is saving it using similar code.
Any pointer to how to resolve this or alternative solution (without using additional mlops libraries) to save the meta data will be appreciated.
My versions for the libraries are following:
pandas=1.5.3
xarray=2022.11.0
netcdf4=1.6.3