Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Allow to_parquet to save the metadata from DataFrame.attrs and load it back #54321

Closed
1 of 3 tasks
xiki-tempula opened this issue Jul 31, 2023 · 5 comments
Closed
1 of 3 tasks
Assignees
Labels
Enhancement IO Parquet parquet, feather metadata _metadata, .attrs

Comments

@xiki-tempula
Copy link
Contributor

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

Pandas allow one to store metadata in DataFrame.attrs. Similarly pyarrow allow one to store meta data via the metadata option in pa.schema.
However, if one try to use DataFrame.to_parquet to convert a pandas dataframe into a parquet file via pyarrow and then load it back. The metadata has been lost.

Feature Description

import pandas as pd
df = pd.DataFrame(data={1:[1]})
df.attrs={1:1}
df.to_parquet('test.p')
new_df = pd.read_parquet('test.p')
new_df.attrs == {1:1}

Alternative Solutions

N/A

Additional Context

No response

@xiki-tempula xiki-tempula added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 31, 2023
@lithomas1 lithomas1 added IO Parquet parquet, feather metadata _metadata, .attrs and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 31, 2023
@lithomas1
Copy link
Member

Contributions welcome for this.

@SanjithChockan
Copy link
Contributor

take

@davetapley
Copy link
Contributor

This is done and in 2.1.0 🎉

@xiki-tempula
Copy link
Contributor Author

Thanks!

@aufdenkampe
Copy link

Thanks! This will be incredibly valuable for those of us who need to keep track of units of quantities!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement IO Parquet parquet, feather metadata _metadata, .attrs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants