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

Add rekey method #60

Closed
rofinn opened this issue Apr 21, 2021 · 1 comment · Fixed by #63
Closed

Add rekey method #60

rofinn opened this issue Apr 21, 2021 · 1 comment · Fixed by #63

Comments

@rofinn
Copy link
Collaborator

rofinn commented Apr 21, 2021

It's kind of annoying needing to reconstruct a KeyedArray every time you want to replace the keys in an array. I was thinking that we could do something similar to rename:

rekey(ka, (key1, key2, ...))
rekey(ka, dim1 => key1)

Maybe also:

rekey(ka, dim1 => (newdim, key1))

To do a rename and rekey in one operation?

NOTE: We're already doing a version of this in AxisSets.jl, but it'd be nice if we could just extend a method here.

@mcabbott
Copy link
Owner

Sounds good. Unlike rename, there's no confusion which way the arrow goes, so rekey(ka; dim1=kv1) would also be OK.

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

Successfully merging a pull request may close this issue.

2 participants