Wolfram: Association. Delete Items by Index
Get Items by Index or Index Range
Take
-
Take[ asso, n ]
→ first n items.Take[ asso, -n ]
→ last n items.Take[ asso, {n} ]
→ nth item.Take[ asso, {m,n} ]
→ m to n.
Take[ Association[ a -> 1, b -> 2, c -> 3, d -> 4 ], 2 ] (* <|a -> 1, b -> 2|> *)
Delete Items by Index or Index Range
Drop
-
Drop[ asso, n ]
→ remove first n items.Drop[ asso, -n ]
→ remove last n items.Drop[ asso, {n} ]
→ remove nth item.Drop[ asso, {m,n} ]
→ remove m to n.
Drop[ Association[ a -> 1, b -> 2, c -> 3, d -> 4 ], 2 ] (* <|c -> 3, d -> 4|> *)
Delete
-
Delete[ asso, n ]
→ remove nth item.Delete[ asso, Key[ b ] ]
→ remove item of key b
(* delete at index 2 *) Delete[ Association[ a -> 1, b -> 2, c -> 3, d -> 4 ], 2 ] (* <|a -> 1, c -> 3, d -> 4|> *)
(* delete key b *) Delete[ Association[ a -> 1, b -> 2, c -> 3, d -> 4 ], Key[ b ] ] (* <|a -> 1, c -> 3, d -> 4|> *)
Wolfram. Association (Key Value List)
- Wolfram: Association (Key Value List)
- Wolfram: Create Association
- Wolfram: Association. Add Item
- Wolfram: Association. Get Value
- Wolfram: Association. Check Key Exist
- Wolfram: Association. Check Value Exist
- Wolfram: Association. Delete Items by Key
- Wolfram: Association. Delete Items by Index
- Wolfram: Association. Delete Items by Filter
- Wolfram: Association. Sort
- Wolfram: Association. Union, Intersection, Complement, Etc
- Wolfram: Association. Map Function
- Wolfram: Association. Get All Keys or Values
- Wolfram: JSON Import Export