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

Would it be difficult to add support for using symbols as keys to ZArray? #128

Open
alex-s-gardner opened this issue Nov 17, 2023 · 3 comments

Comments

@alex-s-gardner
Copy link
Contributor

Working with DataFrames, I've become accustomed to using symbols for keys and I'm wondering if it's trivial to add support for this in Zarr?

e.g.
z = zopen(path2zarr);
z[:var_name]

@meggart
Copy link
Collaborator

meggart commented Nov 20, 2023

Would not be difficult at all. Here is the getindex implementation for a ZGroup

Zarr.jl/src/ZGroup.jl

Lines 69 to 77 in cbcaead

function Base.getindex(g::ZGroup, k)
if haskey(g.groups, k)
return g.groups[k]
elseif haskey(g.arrays, k)
return g.arrays[k]
else
throw(KeyError("Zarr Dataset does not contain $k"))
end
end
, we could either add a method for k::Symbol or justv convert the keys to Strings in general.

@meggart
Copy link
Collaborator

meggart commented Nov 20, 2023

A PR would be great.

@alex-s-gardner
Copy link
Contributor Author

#130

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

No branches or pull requests

2 participants