Questions tagged [associations]

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

Filter by
Sorted by
Tagged with
1
vote
3answers
59 views

Merging associations other than zeros

I am importing different associations and wanting to merge them. An example of these associations are: ...
3
votes
1answer
40 views

Why is extracting values from an Association with 1 level slower than extracting values from a list of depth 1?

I am not looking for a solution or work-around, but an explanation. Here are six examples of doing a trivial operation on an association and a list. Initially, I was curious about the cost of calling ...
1
vote
0answers
53 views

Lists of rules vs. Associations

It seems that generally, Mathematica users (or at least the Q&A I've read here) prefer associations to represent data in ways that many other languages would use structures. However, when ...
4
votes
2answers
57 views

Reduction of nested association based on criteria

I have a nested association of the following form: ...
1
vote
1answer
85 views

How to merge two DateObject list together?

I have two huge lists of flight data(one is around 7 million observations and another is around 1 million). The first one contains the city names, the departure time(accurate to the minute), and some ...
4
votes
1answer
95 views

Better way to create a Dataset?

I'd like to create a Dataset from an array, where each column's heading becomes the key for all elements in that column. I can accomplish this using nested Table commands, but was wondering if there ...
3
votes
1answer
48 views

Front end fails to represent correctly boxes

Context Sometimes my front end misrepresents some output typically involving associations. For instance EmbedCode[CloudDeploy["hello, world"]] should ...
5
votes
2answers
156 views

Extract held value from Association

Consider an association which contains a key which must not be prematurely evaluated. assoc = <| key :> value |> For example, a value of ...
6
votes
4answers
182 views

Sorting Associations by DayName (day of week) using KeySort and/or KeySortBy

I have an association where the keys are the days of the week: ...
9
votes
0answers
106 views

Mysterious Intersection on Association

I have try to do an intersection on list of associations and the result is astonishing. Here an example: ...
3
votes
1answer
43 views

How to extract items from a LearnedDistribution object?

I have never understood how to use Cases to extract items from objects (other than exactly copying code written by others which, again, means I don't understand). I ...
1
vote
1answer
37 views

Fastest way to convert two associations into a sparse matrix

I have two association $N$ and $C$ $N$ has this form : $N=<|x_1\rightarrow \{x_{1,1},...x_{1,p_1}\},x_2\rightarrow \{x_{2,1},...x_{2,p_2}\}...,x_D\rightarrow \{x_{D1},...x_{Dp_D}\} |>$ $C$ has ...
5
votes
1answer
50 views

Grouping dataset by tags

Here is a slight modificaiton of Mathematica's example dataset from the documentation: ...
2
votes
0answers
48 views

Handling lists indexed with integer partitions

I am trying to do some exploration around the multi-dimensional version of [truncated moment problem], where I work with various distributions (uni- or multi-variate), and use some truncated moment ...
1
vote
1answer
69 views

Redefining dot notation for Association

I'm trying to use Associations as object, and specifically want to use them as they are used in other languages using the dot notation. I'm using the code below to get started. ...
4
votes
3answers
91 views

Joining two datasets if second is association of associations

JoinAcross of two datasets does not work, because the second dataset is an association {key_i -> association_i} instead of a ...
0
votes
1answer
34 views

Import multiple sheets from one excel file to one datasheet

This is probably quite a simple question for you guys but I've just started M and I've been mulling this problem for a few days and I think I am well and truly stuck. So any help would be greatly ...
6
votes
1answer
97 views

Exporting Associations (containing lists and strings as keys and values) to python dictionaries

Since Mathematica Associations are similar objects to python dictionaries I think there should be an easy way to export a Mathematica ...
17
votes
1answer
387 views

What's the difference between these 2 associations?

I have 2 associations similar to these simplified ones: ...
3
votes
1answer
117 views

Getting keys of an 'Association'

Suppose you have an association of the type: ...
1
vote
1answer
88 views

Optimal way to evaluate a function over many points

This piggy-backs on my previous question: Parameter space search routine is too fast? I am looking for a fast way to evaluate a symbolic list over many points. So lets say I have a list of symbolic ...
6
votes
3answers
177 views

How to convert a Dataset into an indexed dataset / association-of-associations given a column header?

Given a dataset as such If "letter" is the header that is chosen, how do I convert it into an indexed dataset / association-of-associations? i.e. How do ...
2
votes
1answer
55 views

Association and TemplateApply problem in associations section of The Wolfram Language:Fast introduction to programmers

I am going over The Wolfram Language:Fast introduction to programmers. In the associations section, following question and answer is given Which of the following applies a template to make a string ...
0
votes
0answers
34 views

Working with associations: summing

Consider some association: ...
0
votes
0answers
35 views

Working with associations: precomputing

Consider some association: ...
4
votes
1answer
79 views

Key-dependent maps preserving association

Suppose I have some association a0 = <| key1 -> val1, ... |> and some function f[key, val]. I'd like to produce the ...
5
votes
2answers
187 views

Permute association key and generate a sparse array

Imagine having an Association Av = <|{1, 4, 2, 3} -> a, {2, 4, 2, 4} -> b|> It can be much longer. I am searching ...
4
votes
3answers
420 views

Apply a function to each row of a Dataset

Have a Dataset which is derived from the output from another program. Have written some functions to retrieve and format this data. Can make this work as intended ...
0
votes
1answer
31 views

Join[] messes with the parameters to SendMail[]

I am looking to have a program that can shift between a few different email accounts and am personally storing credentials. I noticed that: ...
1
vote
1answer
74 views

Sort a nested Association by another Association

I have a nested association of numerous pixel values sorted by sample date (e.g. 20190422C) and futher by a strain percentage (e.g. 0, 30, 50). I want to sort it even further using and Association of ...
1
vote
2answers
49 views

Substituting values from an association thread into a table of expressions

I have asked a question here. Yet I am trying to do the same procedure with AssociationThread Suppose I have the following function which is a normal distribution: <...
1
vote
0answers
66 views

12.1.1 “Part” functionality having issues with Dataset [closed]

I made some large datasets of SEM micrograph images and metadata in 12.0 and they have been working no problem for several weeks. but now when I run the notebook in 12.1.1, it seems that it fails to ...
3
votes
1answer
64 views

Associate pairs of data

What I want is to associate the pairs of a nested list, like this: ...
5
votes
2answers
277 views

Why association pattern unmatched when using variable

I have association and want to replace integer in specific element in this association. I'm trying to build pattern to be used by ReplaceAll command. When number is ...
1
vote
4answers
81 views

Distribute association over a list

I have a list {1,2,3,4,5,6} which I would like to associate to another list {a,b,c} by the rule ...
0
votes
1answer
50 views

How do you rearrange a list of strings based given certain conditions?

I had looked at previous answers for this but was unable to find a solution. I have the following code: ...
7
votes
4answers
318 views

Why AssociateTo does not work when Association is inside a list?

V 12.1 on windows 10. I am still learning how to use Associations. This is very strange. I wanted to change field in association using AssociateTo. When the ...
2
votes
1answer
47 views

on display of DataSet using list of associations. How to make header layout independent of order in list?

V 12.1 on windows. I use Associations allot as input for my dsolve solver I am writing. I do not use Dataset, other than to ...
4
votes
1answer
70 views

Dataset rearrangement

I have a datatset , and I want to sort the elements in the second column so that the elements in the other columns change accordingly. ...
1
vote
3answers
69 views

Can you map an AssociationThread of multiple sublists?

I have two lists that look like this: d={{1,1,3,5,7,2},{1,1,3,5,6,7,2}} dd={{A1,A1,A3,A5,A7,A2},{A1,A1,A3,A5,A6,A7,A2}} If I use ...
0
votes
0answers
54 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
98 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
125 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: ...
2
votes
1answer
51 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
76 views

Find the values of the largest key of an association

I have an association: ...
2
votes
1answer
109 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: ...
4
votes
0answers
57 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
65 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
62 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 ...
3
votes
1answer
47 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 ...

1
2 3 4 5
10