Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [associations]

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

Filter by
Sorted by
Tagged with
3
votes
1answer
85 views

Table from grouping an association by value

I have an Association with lots of key-value pairs. The values are integer numbers from a finite set. I'd like to group all the keys that have a certain number as value, and make a table with values (...
4
votes
1answer
196 views

Create a bijection between two lists

Is there a way to create a two-way association or a bijection between two lists of equal length? I know I can use AssociationThread twice, flipping the arguments, but how can I create a bijective ...
8
votes
0answers
132 views

Relation between the syntactic and evaluated Association

This question is inspired by this answer and related to unsolved post "Association's Attributes change between 10.3.1 & 10.4"...
3
votes
0answers
104 views

JoinAcross for large Datasets [closed]

When running JoinAcross for larger datasets (lists of associations, ~100k lines, >100 columns) in Mathematica 10.1 I get the following behaviour: ...
11
votes
1answer
861 views

A comprehensive list of all correct input formats for [[experimental]] Neural Net functions?

Question: correct formats for Mathematica's NetTrain function Explanation of the problem Background So Mathematica 11 was released earlier this month, and while there are many improvements and they ...
18
votes
2answers
309 views

Association's Attributes change between 10.3.1 & 10.4?

In Mathematica 10.3.1 In[1]:= Attributes[Association] Out[1]= {Protected} In Mathematica 10.4: ...
7
votes
1answer
209 views

JoinAcross Crashes Kernel in Version 11.0

Bug introduced in 11.0.0 and fixed in 11.0.1 The following executes without issue in 10.4.1 and returns immediately. However in 11.0 when the JoinAcross line is ...
4
votes
1answer
168 views

Create tree association using table

Suppose I have a table like the following (This example is simplified, actual table is much larger), it is read from external files: ...
13
votes
3answers
370 views

Dataset collapsing/reducing

I have a dataset ds with 3 columns named A, B, C. Columns A and B have repeated values. How can I obtain another dataset that contains a list of the values in C for ...
4
votes
1answer
147 views

Passing values from a list to Select during a Dataset query

Given a Dataset: ...
0
votes
0answers
79 views

Key mapping an association applied to a distribution

I am attempting to import data from a database, group it according to a given identification parameter, get it's statistically relevant information, and then export it as a JSON object for ...
2
votes
2answers
91 views

Associating values of two matrices through sum

I have the following code: ...
2
votes
2answers
151 views

Picking out multiple keys from an array

I have an imported data set that I've used GroupBy on to be organized by specific elements of the sublists within the data. These keys are strings of numbers (in ...
4
votes
1answer
90 views

Possible bug with `KeyValuePattern` and `Optional`

Bug introduced in 10.4, resolved in 11.0.0 I expect to get 0 on every line of output of this: ...
7
votes
2answers
238 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? ...
3
votes
1answer
189 views

Using Associations and Pattern matching in numerical functions possibly broken

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

Association matching still not working perfectly?

Bug introduced in 10.4 and persisting through 11.1.1 Up until 10.4 you could not match on internal Association structure at all: https://mathematica.stackexchange....
6
votes
3answers
286 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
246 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 ...
5
votes
1answer
126 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 ...
11
votes
1answer
196 views

Nested association values validation. POJsO handling

Sometimes it is convenient to work in your package/app with "objects" like: ...
24
votes
1answer
243 views

Bug with MapAt, Span, and Association?

Bug introduced in 10.0 and fixed in 11.0.0 Related to Mapping (Query) a function at multiple locations in nested data via All, Span, it seems to me that the behavior of ...
6
votes
1answer
110 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
186 views

Query/Part Bug with :>

Bug observed in 10.0.1 and persisting through to 10.4.0 Part can fail with :> ...
4
votes
1answer
60 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
490 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
111 views

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

From some calculations I have ended with Datasets of the form: ...
4
votes
1answer
80 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
164 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
167 views

Duplicate rows with multiple entries

I have a huge dataset, which looks similar to this: ...
1
vote
1answer
352 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 ...
9
votes
1answer
219 views

How to match Association[]?

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

How can I join some values in rows to be value columns in a dataset/association

...
12
votes
1answer
146 views

Unexpected behavior of KeyTake

list = {{a, b, c, e}, {1, 2, b, h}, {"a", "h", 3, 5}}; asso = GroupBy[list, {#[[1]], #[[2]]} &] ...
1
vote
1answer
91 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 ...
6
votes
2answers
111 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. ...
5
votes
1answer
309 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
199 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
228 views

How do I thread an Association?

If I define ...
10
votes
1answer
157 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 ...
7
votes
0answers
59 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
148 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
27 views

Mapping Functions to Associations [duplicate]

If I have the association matrix listed bellow and I want to apply: ...
1
vote
2answers
238 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. ...
7
votes
3answers
337 views

Enabling JoinAcross to merge non-joined keys

I've come across the following "JoinAcrossMerge" sufficiently often to wonder if Dataset's semantics can offer a natural implementation. Say I have 2 datasets (<...
4
votes
1answer
147 views

Associations complement

So I'd like to complement two associations through shared keys... not the best description, so here's an example: ...
13
votes
0answers
271 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
80 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 ...
15
votes
6answers
679 views

Reshaping associations, generalization of GroupBy

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

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

Generate a simple two-level association ...