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

Feature request: for metadata! to accept a dictionary as input #3469

Open
alex-s-gardner opened this issue Sep 27, 2024 · 4 comments
Open

Feature request: for metadata! to accept a dictionary as input #3469

alex-s-gardner opened this issue Sep 27, 2024 · 4 comments
Labels
Milestone

Comments

@alex-s-gardner
Copy link

alex-s-gardner commented Sep 27, 2024

To copy metadata between data frames (df1 and df2) requires:

md = DataFrames.metadata(df1)
for k in keys(md)
    DataFrames.metadata!(df2, k, md[k])
end

It would be convenient if metadata! could directly accept metadata Dict() output so that the above becomes:

DataFrames.metadata!(df2, DataFrames.metadata(df1))

I suspect this would also be handy for setting multiple metadata fields with a single Dict()

@bkamins
Copy link
Member

bkamins commented Sep 29, 2024

Currently https://github.com/JuliaData/TableMetadataTools.jl is intended to support such operations as in DataAPI.jl we wanted to keep a minimal API that is required. Would this extra package meet your needs?

@bkamins bkamins added this to the 1.x milestone Sep 29, 2024
@alex-s-gardner
Copy link
Author

To me its seems that simplifying the copying of metadata between data frames would be best handled in native DataFrames.jl as this is an entry point for most people. I would think that the change to code would be minimal as it would just be a simple DataFrames.metadata! dispatch on a dictionary. But you'll certainly have a more informed view on this than I.

@pdeffebach
Copy link
Contributor

DataFramesMeta.jl already has TableMetaDataTools.jl as a dependency, fwiw. It's really just a matter of adding TableMetaDataTools to your environment.

@alex-s-gardner
Copy link
Author

I guess the distinction between what belongs in what package is always a bit grey. To me it seems that copying of metadata between data frames would be rudimentary operation that should be supported alongside DataFrames.metadata in DataFrames.jl. The question is, is copying metadata a core operation when using DataFrames? If it is then the user should not be expected to load a new package to do the operation.. if not then the operation should be kept in DataFramesMeta.jl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants