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

learn more… | top users | synonyms

5
votes
1answer
47 views

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

Generate a simple two-level association ...
1
vote
1answer
53 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 ...
3
votes
1answer
40 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 ...
8
votes
0answers
139 views
6
votes
4answers
243 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
57 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
214 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
63 views

Map level inconsistencies with Missing values [closed]

Negative Level specs interact with Missing values, eg: ...
7
votes
2answers
142 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 ...
21
votes
2answers
380 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
145 views
9
votes
1answer
68 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: ...
5
votes
1answer
200 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
132 views

Extract part of a matrix

I have imported a matrix from a .txt file (it could be better from an Excel file): ...
3
votes
1answer
173 views

how can i associate the headings of columns/rows with content of itself and then recall what i want after i've imported the excel file in mathematica

Hello, i make another try... I have to import a file like this below (it is an excel file, i show you just the beginnig. it should have thousend of rows and columns). After i've imported the file i ...
29
votes
2answers
574 views

GroupBy twice gives different results

Bug introduced in 7.0 or earlier and persisting through 10.3.1 or later It took me quite a lot of time to finally trace down to this strange output. I really don't know why. First, I create a list ...
3
votes
2answers
109 views

With “named row” nested Datasets: How to Select or Filter rows by row key with criteria from another Dataset?

After some calculations and grouping I have a Dataset similar to the following form: ...
6
votes
0answers
49 views

KeyIntersection fails (?) when an association is empty

I think I found a bug in KeyIntersection (Mma 10.2). To illustrate, input the following: ...
2
votes
2answers
68 views

How to update values of nested association using AssociateTo?

Saying we have an association: asc = <|"A" -> <|"a" -> 1, "b" -> 2, "c" -> 3|>|>; I want to updated values of ...
1
vote
2answers
89 views

How to update values in an Association using a pattern?

Say, having an association: asc = <|"a" -> 5, "b" -> 4, "c" -> 21|> I can updated values like: ...
4
votes
1answer
55 views

How can I get all pairs of values from an association with elements key->list

I have an association of the form ds=<|key1 -> list1, key2 -> list2,... ,keyn -> listn|> I would like a simple way to map a function to all pairs ...
11
votes
1answer
154 views

Fractional Keys in Associations

I got into an unfortunate situation, involving fractions that can get changed by evaluation, which occur as (part of) keys in my associations. I will probably steer far away from the entire situation, ...
6
votes
2answers
109 views

Extract parts from an Association

as = <|1 -> 2.2, 2 -> 3.4, 3 -> 8.1|>; I don't understand the following: as[[1]] 2.2 But I expected to ...
10
votes
3answers
194 views

Association Subtotals with Lists as Keys

I have the following Association: ...
16
votes
1answer
222 views

Aggregation queries on lists of associations in 10.3

Bug introduced in 10.3.0 Some aggregation queries applied to a list of associations (or Dataset's with this structure) lock up the front end or crash the kernel ...
7
votes
2answers
153 views

Allocate amount A according to the distribution of amount B

I have a cost that varies by category and date. I also have the counts of each item type within each category and date. I want to distribute the cost to each of the item types. I'm trying to use ...
0
votes
1answer
83 views

Generating a function with named slots

Say I have an association: a = <|"a" -> "albatross", "b" -> "barbecue", "c" -> "champagne"|> And say I want a function with named slots to ...
3
votes
1answer
76 views

How to insert into a nested list/association?

Considering following nested structure: ...
4
votes
2answers
87 views
5
votes
1answer
83 views

SplitBy problem with Associations

Association keys are supposed to be transparent, but in this reduced example SplitBy fails: ...
3
votes
1answer
83 views

DeleteMissing doesn't match in Association tables

DeleteMissing doesn't work in Association tables: ...
0
votes
1answer
88 views

Turning table into association for Classify

I have the following sample data for 20 users. I know their sex, and the response for three yes/no questions. I am trying to building a classifier to guess their response to the third question, based ...
0
votes
0answers
30 views

What is a proper transaction from nested rules to nested associations? [duplicate]

Considering a list of rules {A -> {A1-> B}} what will be the correct way to come to <|A -> <|A1-> B|>|>? ...
8
votes
2answers
107 views

multiple maps to extract from association

I've got some code that has to extract a lot of information, including some statistics, from an association. There's a lot of repetition in my code and I'm hoping that there's some way to simplify it ...
1
vote
2answers
130 views

Short way to query Dataset by the value of several columns

I learned how to query Dataset for rows that contain a certain value, but now I need to query for a long series of And in chain ...
0
votes
1answer
70 views

Merging two associations

I have two associations: ...
4
votes
0answers
59 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
155 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). ...
8
votes
1answer
164 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
56 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
84 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
57 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 ...
2
votes
0answers
48 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
42 views

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

Considering we have an association like: ...
2
votes
1answer
60 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 ...
11
votes
2answers
327 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, ...
11
votes
1answer
109 views

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

Bug introduced in 10.1 or earlier and fixed in 10.3 According to the documentation, in order to make sure that a value in an association is not evaluated at initialization, one can use a ...
4
votes
0answers
82 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 ...
8
votes
2answers
131 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.: ...