Questions on the associative data-structure introduced in Mathematica version 10.

learn more… | top users | synonyms

-2
votes
0answers
32 views

resetting keys after using GroupBy to total

I think I saw a question like this on the site some time ago, but can't find it. I'm using GroupBy on a list of Associations to ...
5
votes
1answer
66 views

Query or MapAt ragged associations or ignoring Missing values

Related to this question, can functions be mapped to named Keys in ragged lists of Associations? ...
2
votes
1answer
71 views

Using Associations and Pattern matching in numerical functions possibly broken

It looks like the very young feature of pattern matching (/replacing) within Associations (http://mathematica.stackexchange.com/a/119542/6804), with or without ...
5
votes
2answers
65 views

Association matching still not working perfectly?

Up until 10.4 you could not match on internal Association structure at all: http://mathematica.stackexchange.com/a/119542/6804 Now you can, but it seems flawed ...
5
votes
3answers
133 views

How to extract the displayed name of an entity

Entities are typically displayed in their elided form: It's useful when exploring the output of EntityList to have access to the canonical name of the ...
0
votes
1answer
44 views

Mapping AssociationThread over list with repeating keys [closed]

I have two lists. One with the same repeating four keys and the other with unique values. Both are the same length. I want to Associate the first list with the second list. So if that if the 5th ...
4
votes
1answer
78 views

Using delayed evaluation on module variables called through an association

I came up with a construct that works well enough for my current use case but has some flaws (at least I suspect it does). Say we have a function that calculates some stuff that takes a while to ...
9
votes
1answer
112 views

Nested association values validation. POJsO handling

Sometimes it is convenient to work in your package/app with "objects" like: ...
21
votes
0answers
173 views

Bug with MapAt, Span, and Association?

Bug introduced in 10.0 and persisting through 10.4.1 or later Related to Mapping (Query) a function at multiple locations in nested data via All, Span, it seems to me that the behavior of ...
4
votes
1answer
79 views

Mapping (Query) a function at multiple locations in nested data via All, Span

For this data: dt = <|"a"-> <|"x"-> 1|>,"b"-> <|"y"-> 2|>,"c"-> <|"z"->3|>|> It’s awkward when mapping the same ...
7
votes
2answers
134 views

Query/Part Bug with :>

Bug observed in 10.0.1 and persisting through to 10.4.0 Part can fail with :> ...
2
votes
1answer
39 views

A natural syntax for a Query that holds

Often I have an unevaluated expression in a RuleDelayed Key-Value pair and subsequently want ...
3
votes
2answers
164 views

How to Convert a Matrix into an Association?

I have a matrix like this one: test = {{1, "a"}, {3, "b"}} and I want to convert it into an association like this ...
6
votes
1answer
69 views

Built-in (or Terse) Method to Combine and Transpose Datasets

From some calculations I have ended with Datasets of the form: ...
3
votes
1answer
67 views

How come there's no ValueMap? [closed]

There's a KeyMap, but there's no ValueMap. How come? By ValueMap I mean a function that ...
7
votes
1answer
122 views

Can I put Association brackets <| … |> in an autocompletion template?

I have a function f which takes as one of its arguments an Association object, and I would like to produce a nice usage message ...
3
votes
1answer
72 views

Duplicate rows with multiple entries

I have a huge dataset, which looks similar to this: ...
1
vote
1answer
74 views

Create a Dataset object, Association or SparesArray from a matrix [closed]

I need to make queries and operations on a large dataset. What is the easiest way to add keys to matrix so that it is transformed to a dataset, which can later be used to make queries? Let's take ...
8
votes
1answer
85 views

How to match Association[]?

The following input: Cases[{"key" -> Association[]}, HoldPattern["key" -> Association[]]] Returns {}. Why does it not ...
4
votes
0answers
56 views

KeyTake can't take list-pair key

...
1
vote
1answer
54 views

Sorting the words of a phrase by defined variables/associations

Is it possible to change the word order of a phrase by creating a list of possible values/variables and using the Sort function? I want a specific word order always. $(a>b>c>d)$ But the ...
5
votes
2answers
95 views

Is there a function that will transform the values of an association while deleting some that match a criteria?

I am looking for something better than Select[Map[f,a],test] As Map will work over the entire association (a) and then Select will work over all of the results. ...
3
votes
1answer
107 views

Immutability, Association and typing

I have read the article by Leonid on the question. I am still struggling. I am trying to use Association to inject some pseudo-typing in my code. Here is my ...
4
votes
2answers
137 views

Use Select to filter a dataset's sublists

In the following Dataset, I want to use Select to display only rows, which contain numbers in column ...
1
vote
3answers
134 views
9
votes
0answers
67 views

Is there a way to TagSet a HoldAllComplete function?

Let's say I want to overload the built-in function Lookup, to handle my data wrapped in myObject. One would use ...
6
votes
0answers
47 views

Unwanted evaluation of RHS of association in FilterRules

FilterRules is a handy function that works on associations, however it does not respect delayed association-values. RuleDelayed ...
1
vote
1answer
36 views

Using Merge to Combine Associations [duplicate]

Relating to a question I asked earlier at: Creating Association it was said that Merge[] is a more elegant way to associate data. I have an issue when I use to to concatenate associations I have shown ...
0
votes
0answers
23 views

Mapping Functions to Associations [duplicate]

If I have the association matrix listed bellow and I want to apply: ...
1
vote
2answers
62 views

Creating Association [duplicate]

I have provided a dataset bellow and I would like to store the data as an Association that I can query. Such that e.g. ...
4
votes
1answer
114 views

Associations complement

So I'd like to complement two associations through shared keys... not the best description, so here's an example: ...
11
votes
0answers
177 views

Slow JoinAcross performance

Bug introduced in 10.3 I am using JoinAcross to combine two datasets, where the key is an Integer. ...
2
votes
1answer
60 views

Matching and counting reversed pairs in a list

Given a list of character pairs like {{"w", "u"}, {"a", "j"}, {"c", "s"}, {"s", "l"}, ....}, I would like to group the reversed set pairs and then get a total count ...
11
votes
6answers
444 views

Reshaping associations, generalization of GroupBy

Let's say we have a set a\of associations: ...
5
votes
1answer
63 views

Attempting to modify parts of a multi-level association in-place

Generate a simple two-level association ...
1
vote
1answer
70 views

ListPlot a list of Associations, with each pair in Association a different color

As the title states, I'd like to ListPlot a list of Associations, with each pair in ...
4
votes
1answer
45 views

Aliases for keys?

The syntactic sugar for alternatives in replacement rules is clean: {a|b|c-> 1, d->2} Are there any analogous shorthands for keys in associations. I want ...
11
votes
1answer
192 views
6
votes
4answers
263 views

Average dataset with many repetitions?

I have a dataset where each item is of the form: <|"p1" -> x1, "p2" -> x2, "r1" -> y1, "r2" -> y2|> The interpretation is this: ...
2
votes
2answers
94 views

How to delete several elements in an association? [closed]

What is the most efficient way of deleting more than one pairs with known keys in an association? Please check the following failed and successful examples. ...
14
votes
3answers
234 views

ReplaceAll with Associations instead of Rules

I have just noticed that x /. <|x -> 123|> evaluates to 123 In other words, the association seems to behave as a ...
3
votes
0answers
70 views

Map level inconsistencies with Missing values [closed]

Negative Level specs interact with Missing values, eg: ...
7
votes
2answers
149 views

Get association element that has a parameter

Say I have an Association of the form: assoc = <|first->"abc", second[param]->"xyz"|> Now to access ...
25
votes
3answers
459 views

How to organically build up nested associations?

Suppose I want to construct an association of associations, such as a list of people with attributes: ...
6
votes
2answers
152 views
11
votes
2answers
100 views

Replace and Association

I'm surprised that I can't find this question already, so perhaps I'm missing something obvious. I would like to take a list of associations and remove any with value ...
0
votes
0answers
18 views

Slot representing the key in Association? [duplicate]

Is there a slot representation of the Key in an Association? For instance, I would like to do same transformation with an Association: ...
6
votes
1answer
264 views

How to construct a tree from a notebook?

Given the notebook itself we can think of it as a tree graph: the root vertex is the empty notebook itself, the headers of cell groups are vertices, and all other cells as leaf vertices. I'd like to ...
4
votes
2answers
141 views

Extract part of a matrix

I have imported a matrix from a .txt file (it could be better from an Excel file): ...