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

learn more… | top users | synonyms

2
votes
1answer
53 views

Duplicate rows with multiple entries

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

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

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 ...
0
votes
0answers
65 views

Why are my associations not consistantly followed? [closed]

I'm working on a code that automatically reorders the words of a phrase. I'm getting some inconsistencies with the word "glass". EDIT: Sorry for not simplifying the code to a basic example. Here's a ...
6
votes
1answer
73 views

How to match Association[]?

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

KeyTake can't take list-pair key

...
1
vote
1answer
50 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
93 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. ...
2
votes
1answer
90 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
129 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
130 views
9
votes
0answers
65 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
44 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
31 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
21 views

Mapping Functions to Associations [duplicate]

If I have the association matrix listed bellow and I want to apply: ...
1
vote
2answers
55 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
111 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
165 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
59 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
431 views

Reshaping associations, generalization of GroupBy

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

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

Generate a simple two-level association ...
1
vote
1answer
64 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
44 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
149 views
6
votes
4answers
260 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
77 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
229 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
67 views

Map level inconsistencies with Missing values [closed]

Negative Level specs interact with Missing values, eg: ...
7
votes
2answers
147 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 ...
24
votes
3answers
442 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
95 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
233 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
138 views

Extract part of a matrix

I have imported a matrix from a .txt file (it could be better from an Excel file): ...
4
votes
1answer
192 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 ...
30
votes
2answers
601 views

GroupBy twice gives different results

Bug introduced in 7.0 or earlier and persisting through 10.4 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 ...
4
votes
2answers
144 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
50 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
86 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
103 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
68 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 ...
13
votes
1answer
171 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
114 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
204 views

Association Subtotals with Lists as Keys

I have the following Association: ...
17
votes
1answer
233 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
86 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
85 views

How to insert into a nested list/association?

Considering following nested structure: ...
4
votes
2answers
91 views