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

learn more… | top users | synonyms

4
votes
0answers
43 views

How to set a property in an object with association syntax?

I have a simple object orientation example using this solution: ...
6
votes
1answer
121 views

How does thing[“property”] syntax work?

Many builtin "things" support the (usually undocumented) syntax thing["property"], and usually the available properties can be listed using thing["Properties"] (thing["Methods"] might work too). ...
7
votes
1answer
143 views

Different Set Semantics - Why is assoc[“a”] =. different from assoc[[“a”]] =.?

Accessing parts of an Association can be done either using Part or the [] extraction ...
2
votes
1answer
43 views

Associations - getting values according to a key pattern

I want to get all counts of trigrams that with "th" (or any other given digram). ...
6
votes
1answer
73 views

Problem Using Evaluated Replace with Associations

If I define some function like: toISOdate[data_List]:=DateString[data,{"Year","-","Month","-","Day"}] and try to applicate it in an ...
2
votes
1answer
47 views

How to extract part of association?

Considering an association: asc = <|"a"->1, "b"->2, "c"-><|"e"->3, "c"->4|>, "d"->5, "e"->6, "f"-><|"g"->7|>|> How ...
1
vote
0answers
40 views

Reducing quantile & color map queries for use with Associations

This set of queries perform basic maps to quantile and then color-map. There's got to be a more compact solution. What are some approaches to reduction? Numeric: ...
0
votes
1answer
33 views

How to extract an association with similar keys from another association?

Considering we have an association like: ...
2
votes
1answer
50 views

Manipulating unevaluated expressions in nested function calls

This is a follow-up to my earlier question: Passing an unevaluated part of an association to a function I'm trying to create a modular dashboard that controls sound volume of an audio system ...
10
votes
2answers
310 views

Is there an idiomatic way to determine whether an `Association` is a subset of another?

I would like a way to tell if every key-value pair of an Association is contained in another. For instance, ...
10
votes
1answer
84 views

Problem with Clear[assoc] as a value in an Association

According to the documentation, in order to make sure that a value in an association is not evaluated at initialization, one can use a RuleDelayed. This works fine: ...
4
votes
0answers
52 views

TimelinePlot with Interval in Associations

Bug introduced in 10.2 This is related to a previous question I asked about TimelinePlot and multiple associations (Behavior of TimelinePlot with multiple ...
7
votes
2answers
99 views

Passing an unevaluated part of an association to a function

I'm making a UI widget that controls sound volume on a speaker using a slider, e.g.: ...
9
votes
1answer
110 views

Union on Associations (Kernel Kill)

Bug introduced in 10.1 and fixed in 10.2.0 Perhaps Union on Associations is not being encouraged since ...
14
votes
4answers
212 views

Association's Key[key] extraction different in V10.1/V10.2

V10.1: <|a -> 1|>[Key @ a] (* Missing["KeyAbsent", Key[a]]*) V10.0: <|a -> 1|>[Key @ a] (* 1 *) Bug or ...
9
votes
0answers
82 views

Strange result of DeleteCases in an association

The function DeleteCases can be used for associations, also with level specification. Here is an example where some values are associations: ...
0
votes
0answers
13 views

Comparing association using MatchQ [duplicate]

For me below query results into False.I expect it to return True. ...
4
votes
2answers
69 views

How to delete blank valued keys from nested association?

Considering we have: acs = <|"A" -> <|"a" -> " ", "aa" -> "asd"|>, "B" -> <|"bb" -> " "|>|> How can we come to have a result ...
6
votes
1answer
121 views

Is there a practical way to define a default value for missing keys in an Association?

It can be very useful to define background or default value for an object that can be incremented or otherwise modified. A simple (and for me, common) use is a counter: ...
22
votes
2answers
342 views

Dataset vs an association of associations

Associations with a record structure (e.g., a flat table) can be organised in one of two main ways. First as a list of associations, which is also used in the case of Mathematica's data set ...
2
votes
1answer
61 views

Quotes vs No Quotes for Association Keys

I've tended to not put quotes around the names of my Key when making Associations. For example: ...
5
votes
4answers
175 views

Create Nested List from tabular data

Im trying to create a nested list from tabular data, then onward into a nested association. I can get part way with the help of this answer but it only works for the first level. Repeated use of this ...
2
votes
3answers
94 views

How to check keys and values in nested Associations?

Considering we have a an association: ...
10
votes
3answers
172 views

Association of Associations : how to permute level 1 and level 2 keys?

I have a ragged Association of Association, say : ...
4
votes
3answers
97 views

Change value associated with keys using alternatives

I have a List of Associations that contains a Key called "ClaimBasis". There are about 10 possible values that ClaimBasis can take on, one of them being the value Null. I want all values that are ...
2
votes
1answer
96 views

Memory usage optimization for a large Association/SparseArray

Reformulating my question in simpler terms. Take two lists list1 = RandomInteger[{1, 100000000}, 25000000]; list2 = RandomReal[{1, 10}, 25000000]; Make an ...
4
votes
3answers
92 views

Extract all Values from nested Association

Considering we have an Association: ...
1
vote
1answer
94 views

Arrangement Order and Multiple Columns Sorting Order of Associations with Missing Keys

I have the following well-formed JSON string ...
0
votes
1answer
129 views

ParallelTable slower than Table in the presence of an Association?

So after testing some things I am completely reformulating my problem. First an example ...
10
votes
2answers
135 views

Lookup with default broken in Dataset

Given an Association, ...
3
votes
3answers
77 views

Orderless storage of tabulated function values

I would like to elaborate on my previous question Function of arguments given in non-fixed order and a relevant related one Best practice of passing a large number of parameters to functions I find ...
4
votes
1answer
94 views

when two associations are equal?

<|a -> 2, b -> 3|> == <|b -> 3, a -> 2|> returns False; can anybody explain why? If I am not mistaken ...
7
votes
2answers
187 views

Transpose can't handle fractions

Bug introduced in 10.0 and fixed in 10.2.0 Note: Dataset and Association are new in 10.0 Related to this question, why can't ...
4
votes
0answers
74 views

Why is Transpose Dataset slow in one direction

Transpose is faster when it distributes Keys at the 2nd level of a Dataset than when it factors them out. ...
1
vote
2answers
96 views

Import nested JSON file [duplicate]

For a project where I receive JSON messages from a web server I was trying to convert these messages into a format that can be used easily within Mathematica. Because JSON also consists of key-value ...
3
votes
0answers
56 views

Applying functions to irregularly distributed Keys in Association lists

This Q is related to this one, but now refer to the situation as irregularly distributed Keys in lists of Associations: ...
0
votes
1answer
55 views

How to loop in a nested Association?

Considering we have an Association: ...
3
votes
1answer
63 views

How to combine keys in nested list of rules or associations?

Considering we have a list of rules: ...
0
votes
1answer
57 views

How to extract info from Association? [duplicate]

How can one extract a list of keys and a list of values from the association? e.g. as = <|a->1, b->2, c->3, d->4|> ...
7
votes
1answer
145 views

Find and return the key with lowest value in association list

I am still new in Mathematica, and I need some help here. Suppose that I have an association ...
0
votes
1answer
48 views
0
votes
1answer
53 views

How to switch keys in a Map to Association [closed]

I have an association that has parameters for a function. These parameters represent two cases that need to be applied to the function. Some parameter values are common to both cases but some are ...
8
votes
2answers
169 views

JoinAcross on nested association by nested key

I would like to join two associations on nested keys. Is this possible? ...
2
votes
1answer
57 views

Can association be used to find the maximum key less than a specific number?

Suppose we have an association assoc. assoc = <| 1 -> 1, 3 -> 2, 5 -> 3, 7 -> 4, 20 -> 5|>; Instead of ...
4
votes
0answers
48 views

Wrong autogenerated package from notebook containing #key and Part as subscript

Bug introduced in 10.0.0 and persisting through 10.1.0 or later Mathematica v10.1.0, under Windows 8.1 x64 Mathematica v10.0.2, under Windows 1) Define a function in an initialization cell: ...
5
votes
2answers
196 views

Create a list of rules built from data set fields

I want to convert a dataset to a list of features and a list of target values, for use in Predict and also more generally. I know ...
4
votes
3answers
153 views

How to map over inner keys of nested Associations?

Considering an association: <|"a" -> <|aa-> "asc", bb-> "asd", cc-> 0, ImageType -> "asd", dd-> "asd"|>|> How can I make the inner ...
17
votes
1answer
202 views

Why do lookup times in Dataset and Association differ by orders of magnitude?

Consider the following three data structures: a list of rules, an association, and a dataset: ...
1
vote
2answers
131 views

A shortened association

...
6
votes
5answers
333 views

How to switch from List of rules to Association? [duplicate]

Considering we have a list of rules: ...