Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [query]

The tag has no usage guidance.

4
votes
1answer
59 views

Inconsistency in getting Keys, Values and Query for nested Rules

Querying nested Rule expressions of the form a -> v -> b // FullForm Rule[a,Rule[v,b]] for ...
4
votes
2answers
95 views

How to pull out the underlying query syntax being used by dataset?

Consider the following dataset. titanic = ExampleData[{"Dataset", "Titanic"}] If I use the lookup syntax of the dataset like following it creates an equivalent <...
8
votes
2answers
148 views

Query inside Dynamic triggers continuous high CPU load for FE

Here is a (vicious) problem I am able to reproduce with v12 and v11.3 (previous versions not tested) and OSX. This is a minimal example to demonstrate it (even if it seems useless here I do need <...
1
vote
0answers
37 views

How do I Select when the key of an association is a multi-word string [closed]

I have imported some survey responses into a Dataset. I now want to select those rows where the response to "participant type" == "Virtual". I discovered that this ...
4
votes
2answers
50 views

Simple dataset query

Why does taking a Part fail in a Dataset query function when there is an operation in the index argument? ...
2
votes
1answer
70 views

Replacing values in a dataset

Could someone explain why ...
0
votes
1answer
127 views

Aggregate function problem

I use a function to do something similar to a SQL sum. I've asked about simplifying it in another post. I'm still using this function and it works well for aggregates like ...
4
votes
1answer
60 views

Operator form for Histogram of multiple datasets?

I would like to plot a histogram for multiple datasets in a dataset query, but can't quite seem to make it work in operator notation: ...
0
votes
0answers
65 views

Nested Dataset and the Query operator

Suppose I have the following Dataset, one of whose columns is a nested Dataset: ...
2
votes
0answers
30 views

Keyed eigensystem for nested Association

Suppose a matrix is given where both rows and columns are keyed, for example this correlation matrix: ...
2
votes
1answer
49 views

Handling Missing values flexibly in Query (MissingBehavior problem)

There’s an inconsistency in how Missing values are imputed in Query, with ...
6
votes
1answer
244 views

How to filter this nested list of Association

For example, I have the following data ...
3
votes
1answer
113 views

Query from Association of Associations Dataset

I have a rather large dataset comprised of Association of Associations. For better or worse, I've converted this into a Dataset. Here is a simplified version of ...
7
votes
3answers
237 views

Applying a function by Key pattern, preserving Association order

Any convenient ways to apply a function to Keys that match a pattern in an Association? Method should handle: Mixture of ...
8
votes
1answer
81 views

Unexpected behavior of PreIncrement when querying associations

For reasons I won't go into here, I became curious about the what would happen should I make a query that applies PreIncrement to one key in a list of associations....
4
votes
0answers
86 views

How to get parent key in Query on Association/Dataset?

Is there a general and terse method to obtain the parent key of the current "position" in a Query of an Association/...
4
votes
2answers
26 views

How to Quiet an operator to avoid Query fail

This Query fail, due to divide by zero error message... <|"a" -> 1, "b" -> 0|> // Query[#a/#b &] Missing["Failed"] ...can be prevented by ...
8
votes
1answer
322 views

Transpose fail in 11.1 Dataset

The type system underlying Dataset seems a total kludge, as soon as one issue is fixed, here it recurs in a slightly different form - and difficult to isolate in minimal examples. Here's a failure ...
3
votes
1answer
71 views

Dataset type system fail with composite keys and Infinity

In 11.1, a Dataset consisting of an Association with composite keys with an Infinity causes failure in keying-in: ...
9
votes
2answers
165 views

Getting slices of a nested Association via Query

I'd like to get specific slices from a nested database-like Association through Query. Take for example this toy database of ...
3
votes
2answers
118 views

Composition with Transpose failure with Dataset

Is the failure of the 2nd Transpose here a known bug? Dataset[{{0, 10}, {2, 11}, {3, 12}}][ Transpose /* Map[MinMax] /* Transpose] // Normal ...
11
votes
2answers
236 views

Simplifying a reverse Fold for a Query

Is there a simpler way to parametrize this tail-recursive expression to be applied as a Query (for processing a nested ...
9
votes
2answers
204 views

Slicing an Association with named key span without normalizing?

Is there way to slice an Association with named key span? Span currently doesn't accept named keys: ...
20
votes
2answers
353 views

Query: adding additional operator changes meaning of preceding operators

Consider the following query: Range[5] // Query[Select[EvenQ] /* Append[1], f] (* {f[2], f[4], 1} *) It selects the even numbers, applies ...
3
votes
0answers
56 views

Aligning input form of a sequence of Queries

Is there a way to modify the parser, or define options, to align the indentation of a sequence of Queries on a Dataset? Given: ds = <|"a" -> 1, "b" -> <|"c" -> 2|>, "d" -> <|"e" -> 3, "f" ...
11
votes
0answers
168 views

Unix-like reference to parent and root Association?

Is there a syntax or function to reference parent and root when querying nested Associations similar to Unix' ".." and "/", eg "cd ../../mydir". ? Here's a typical application of the root construct....
2
votes
1answer
150 views

Query and Dataset Syntax Peculiarities

Question Can someone please explain to me the syntax of Query and why its behavior is so befuddling to me at the moment? I am going to go through a few simple ...
11
votes
2answers
193 views

Large Dataset query fails if column contains Missing

In version 11.0 (Win 8.1 Pro) a query on a large Dataset for a column that contains Missing fails most unceremoniously. With <...
4
votes
1answer
137 views
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 ...
10
votes
2answers
172 views

A subtlety in Query

Let us consider a simple Dataset: ds=Dataset[{<|"a"->12,"b"->4|>,<|"a"->7,"b"->8|>,<|"b"->3|>}] Column "b" is easy to find: <...
7
votes
2answers
125 views

Nothing in a Query

In Mathematica 10, Nothing is defined as to automaticaly disappear when used in a list or in an association, and moreover with the property that it returns ...
17
votes
1answer
279 views

Aggregation queries on lists of associations in 10.3

Bug introduced in 10.3.0 and fixed in 10.3.1 Bug introduced in 10.3.0 and fixed in 10.4.0 First bug, see first part of the question Second bug, see update part Some aggregation queries applied to ...
18
votes
1answer
493 views

Struggling to understand Query

The documentation for Query starts with: ...
5
votes
2answers
292 views

Remove rows from dataset using query

MyDataSet[Select[#point[Fsr] == 1 &]] returns the row I want to delete, now I am trying what looks to me the most logic command to remove these rows, which is <...
11
votes
2answers
297 views

Query datasets with “variable” named slots

I want to query a Dataset object, e.g. select some entries using ...
36
votes
1answer
597 views

Visualizing Type System Operations

With the introduction of Dataset in version 10, Mathematica acquired a static type-checking subsystem. A fair number of dataset-related questions here on MSE ...
2
votes
0answers
97 views

Reducing quantile & color map queries for use with Associations [closed]

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: ...
11
votes
1answer
164 views

Preventing Keys from appearing in Query Output (+ the casting of Ascending/Descending operators)

One of the challenges of coming to grips with Query's on Association's and Datasets is ...
2
votes
2answers
367 views

Query in Lists Mathematica - Pivot table

Recently, I finished a simulation, and I got the following data: ...
4
votes
1answer
254 views

Query Dataset to check if row contains any from a set of values

For a given keyless dataset, I can query to return the rows whose columns contain a specific value. For example: ...
2
votes
2answers
200 views

A Query using Select and Quiet fails but Select by itself works

This is closely related to the question here, the key difference is that here data is structured as nested Association rather than a flat list: ...
6
votes
1answer
239 views

Select query with named slot lookups?

Given this Dataset fragment (copy-paste friendly version at bottom) Can this query be simplified by referencing named slots directly in the ...
11
votes
1answer
283 views

10.0.2 breaks a recursive “trie” query

Bug introduced in 10.0.2 and fixed in 10.2 The 10.0.2 Dataset type system complication breaks a recursive trie constructor that worked in 0.1: ...
5
votes
1answer
311 views

Filtering Query Nested Data (Dataset and Association)

I am trying to filter a nested Dataset. I have some data that looks like this (curated for this example): ...
2
votes
1answer
150 views

Dataset Query with condition on two subsequent rows

The following Dataset ...
12
votes
5answers
824 views

Applying a function to a Dataset column conditional on another slot's value

How to apply a function to a column conditional on another slot's value? The Dataset documentation show only how to apply a function to named slots independently. The ...
1
vote
1answer
102 views

How can I “ORDER BY” using SQLSelect?

A pretty straightforward problem, you would think, but I cannot seem to find the answer in the documentation for SQLSelect. The query I want to run is the following: ...
9
votes
3answers
272 views

Problem constructing Association tables with some operators

fixed in 10.0.2 First, set up the example Dataset from the documentation: titanic = ExampleData[{"Dataset", "Titanic"}]; Why ...
5
votes
2answers
270 views

How to lookup by a string key after GroupBy? Inconsistent data type handling

This is relates to a bug that was introduced in 10.0.0 and fixed in 10.0.1 It also relates to an issue that has yet to be corrected. After applying GroupBy to a ...