2
$\begingroup$

Considering an association:

asc = <|"a"->1, "b"->2, "c"-><|"e"->3, "c"->4|>, "d"->5, "e"->6, "f"-><|"g"->7|>|>

How to extract "c" and "f" from asc to have :

ascNew =  <|"a"->1, "b"->2, "d"->5, "e"->6|>
estracted =  <|"c"-><|"e"->3, "c"->4|>, "f"-><|"g"->7|>|>

Thanks!

$\endgroup$
5
$\begingroup$
Through[{KeyDrop, KeyTake}[asc, {"c", "f"}]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.