Questions tagged [associations]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
44 views

Mapping on changing list

for those who have seen it, I have deleted my previous question, as suggested by @Αλέξανδρος Ζεγγ, The goal : Modifying dynamically the list on which a mapping is done I try to give you a concrete ...
4
votes
1answer
87 views

What is a more expedient way to assign variable names to individual elements in a list?

There is a set of one-dimensional descriptive statistics that I need so often that instead of copying and pasting calculations each time I created a function (...
4
votes
2answers
105 views

Create a indexed list

I am trying to create an indexed list with Association[] but i getting only a few keys when accesing a specific key. Here is the code: ...
0
votes
1answer
30 views

level 2 MapThread over association

Consider a 2D array of Associations. MapThread is used to simultaneously supply it to some function with other args ...
3
votes
2answers
59 views

Find the values of the largest key of an association

I have an association: ...
2
votes
1answer
57 views

How can I convert this Dataset to List

I'm very new to Mathematica, I'm having the following dataset structure : I want to get data in the following way so that I plot it to TimeSeries using joined/left[1/0] as v and ts as time: ...
3
votes
0answers
27 views

Fastest way to change the values of an association

I have an association of the following form : assoc = Association[a -> {1, 2, 3}, b -> {5, 6, 7}] <|a -> {1, 2, 3}, b -> {5, 6, 7}|> (the size ...
5
votes
0answers
49 views

Can't seem to match multiple KeyValuePatterns in one pattern

Let's define a couple patterns that we can use to match Associations. ...
1
vote
1answer
54 views

A more efficient way to interrogate data inside a Dataset: a generic relational map

I have a Dataset that stores the relationships between people IDs (in columns) and the events they attended (in rows). I want to produce a linear text report of those relationships. How can I do this ...
2
votes
1answer
36 views

Values fails to remove Association

I am toying with an anharmonic oscillator with potential LJ[delta_, w_] := (w^2 - delta*w^4) and I want to find the turning points for oscillations in the right ...
14
votes
2answers
322 views

Does anyone know a way to use patterns in Query?

This question is a follow up from my previous question. Query has a nice syntax that allows it to apply functions on association based on specific ...
2
votes
1answer
74 views

How to find the intersection of all sub parts of each key

How to delete the redundant parts of each association according to the corresponding intersection of parts in the key list. ...
3
votes
3answers
74 views

Adding values of an association through pattern matching

I have an Association in which values are lists of lists containing an Integer and a DateObject. I would like to build a function that adds all Integers that have the same dates. ...
3
votes
1answer
89 views

How to get the first value of the duplicate in this association list

I have the following association list. I want to get the first value of the duplicate item, but only the last value. What should I do? ...
4
votes
1answer
78 views

Use Lookup on associations that contain conditional statements

I am using conditional statements in a list of rules to replace values in a vector of data. Since the same operation can be performed faster using Lookup on associations I would like to use this ...
2
votes
1answer
45 views

Map a function to every given key of a nested association

Consider for example the nested association: myA = <|"d" -> <|"c" -> <|"a" -> 1, "b" -> 2|>|>|> It is easy to map a function to a ...
3
votes
1answer
44 views

Indexed KeyValueMap

I have been trying to figure it out and I am probably very close, but I have spent 2 hours without sucess. I have the expression below ...
1
vote
1answer
30 views

Association auto-populating with ChoiceDialog

While trying to use the ChoiceDialog function to populate an association, I have run into an interesting issue... ...
1
vote
2answers
63 views

Extracting values from Associations

I have data stored in a list of Associations. I would like to extract the values only for multiple keys. I was hoping to do it the same way list[[All,{1,2}]] can be used. But when I use this syntax ...
1
vote
3answers
55 views

Single association: group keys together by equivalence relation and total their values

What is a relatively concise set of operations that will allow me to take a single association with a set of old keys and old values and map it to a new association with new keys that are effectively ...
1
vote
0answers
45 views

Append columns to a Dataset without unpacking via Normal [duplicate]

I would consider myself transitioning from beginner to intermediate skill in Mathematica, and am finally exploring Associations and Datasets. I am using version 12. I have a Dataset (list of ...
0
votes
0answers
39 views

How to use Headers after imported them?

I read this post here, and played a bit with the Import function, so I now have my data imported from xlsx file, which say is a <...
4
votes
4answers
155 views

Change a list of associations by applying a function to specific keys?

If I have a list of associations (listAssoc) with members all having key someKey, how can I generate a new list of associations <...
13
votes
3answers
286 views

How to make arbitrary transpositions of associations and datasets

Is there a general Transpose for Dataset/Association that will transpose arbitrary levels, ...
19
votes
4answers
1k views

Merge function performing too slowly; what can be done about it?

I have an extremely large CSV file that contains only entries like the following: ...
2
votes
0answers
41 views

KeyUnion by equivalent patterns

I have associations whose keys are patterns. For example, ass1 = <|a_ -> 1, f[] -> 3|>; ass2 = <|b_ -> 2|>; I would like to construct the ...
5
votes
1answer
76 views

Summing Values in an “Association” with the same Keys

I have a datastructure which is similar to an association: However, it has duplicate "keys" (different entries with the same date) with different values (measured in hours). What I'd like do is ...
3
votes
2answers
90 views

Adding together values from different association lists

I have two association lists, whose values are integers, sharing some but not all keys. For a small example, we might have ...
5
votes
1answer
92 views

Apply a function over Dataset as if it's an Association

Take a list of Associations. Using the Dataset function, this can be converted to a structured dataset. ...
2
votes
0answers
42 views

Convert Key to Value in Dataset with nested Associations [duplicate]

Let's say I have a Dataset consisting of nested Associations (in this case, created through a ...
2
votes
1answer
34 views

Create an Association with Key->Value dependent on a previous Key->Value

I am trying to find a way to create an association (preferably without iterating) with values dependent on other values in the association. I know that this is incorrect, but an attempt that I've ...
11
votes
1answer
188 views

Reversing a GroupBy operation

Suppose that I have a this list of associations ...
6
votes
1answer
95 views

How to use a function as a value in an association? [closed]

I just started learning Mathematica. I was wondering if it is possible to use a function as an value in an association. Ideally, it would be something like this: ...
2
votes
2answers
58 views

How to associate the elements of a list to numbers?

I am having problems to understand the association function. I have a list of lists containing numbers: ...
8
votes
2answers
193 views

Taking the first element in a list of associations

I have the following list which is built up of associations, that is, ...
5
votes
3answers
105 views

Sort Associations by its Values (which are nested lists)

I have associations where the values are nested lists: ...
14
votes
3answers
313 views

Evaluated vs. unevaluated Association

This question might have a remote connection to my older question, it is also about sameness of expressions and subtle differences observable only in certain forms. I encountered this strange ...
3
votes
1answer
88 views

Edit value in nested Association

Here is a simplified version of my problem. I have a nested Association. ...
5
votes
3answers
301 views

Changing Row Keys into Normal Rows

I have a dataset with column and row keys: ...
6
votes
2answers
130 views

How to define a functional that produces at runtime a function by evaluating selected parts in its definition?

Consider the following functional as an example: ...
3
votes
2answers
79 views

Row Keys in Datasets: JoinAcross row keys; Demoting or deleting row keys

I want to combine two datasets that share row keys but have different column keys. Visually, this looks like a JoinAcross on the row keys to me, but the column of row keys doesn't appear to be named. ...
7
votes
2answers
105 views

Creating a new Dataset column using a map from a second Dataset

Say I have two datasets: one is a detailed list of events, and one is a coarse list of events. I want to add a column to the detailed list from the coarse list (for the purposes of sorting). For ...
11
votes
3answers
308 views

Move the outer key inward in an association

I have a list that looks like: ...
1
vote
0answers
29 views

Having trouble distributing a large association to sub-kernels

The following seems to work based on memory usage. ...
5
votes
3answers
250 views

Iterate over deepest values in a nested Association

Is it possible to iterate over the values of the deepest layer of keys in a nested association? For example: ...
1
vote
0answers
50 views

Wrapping an association with a specialization of the buildin `Set` (=) function?

I want to wrap some association data into a dedicated symbol (S by example) ...
1
vote
2answers
86 views

How to use KeyValuePattern with individual replacement rules?

What's the syntax to use individual replacement rules for key-value patterns? This returns only the first match: ...
4
votes
4answers
137 views

Neat redistribution of association values

Given an original association: original = <| "a" -> {a1, a2}, "b" -> {b1, b2}, "c" -> {c1, c2} |> and a set of redistribution rules e.g. <...
1
vote
2answers
127 views

Create Dataset from lists

Let's assume I created the following dataset: ...
2
votes
1answer
40 views

Hierarchically adding {…keys..}->value to an association

Given a list of keys {"a","b","c"} and a value 3 (associated to the last key) I want to define a function that is equivalent to ...

1
2 3 4 5
9