JuliaData / DataAPI.jl

A data-focused namespace for packages to share functions
Other
33 stars 13 forks source link

default to metadata! style=:default #55

Closed nathanrboyer closed 1 year ago

nathanrboyer commented 1 year ago

Maybe this was discussed already, but I would think a style named :default would be defaulted to if style is not provided. I would like to see style as an optional keyword argument so that metadata!(df, "key", "value") is allowed. (Then TableMetadataTools.jl would define a way to change what style metadata!(df, "key", "value") uses.)

bkamins commented 1 year ago

@nathanrboyer - this is an issue for DataAPI.jl, so I am moving it.

bkamins commented 1 year ago

@nalimilan - what do you think?

To start with I wanted setting style to be explicit, but maybe indeed allowing for :default by default is better.

@nathanrboyer - I am working on TableMetadataTools.jl so expect changes in the code.

nathanrboyer commented 1 year ago

I can write this at the top of my script to get the desired behavior, but there is probably a cleaner way with metaprogramming: DataFrames.metadata!(df::DataFrame, key::AbstractString, value::Any) = DataFrames.metadata!(df, key, value; style=:default)

nathanrboyer commented 1 year ago

If it was named something other than :default, then I could see forcing the user to be explicit in the main package and only providing the convenience method in the helper package.

bkamins commented 1 year ago

I understand your rationale. Let us wait for @nalimilan to comment. The change will be easy to implement.

nalimilan commented 1 year ago

Sounds good.