Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 142

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

12
votes
(* True *) This is basically equivalent to using JoinAcross with full-outer-join semantics. Explanation The ultimate goal is to relationally join associations by a composite key consisting of the … presently support subpart references. We have little option but to implement the join directly ourselves. In order to merge related associations from the two lists first and second, we need to gather …
answered Apr 19 '15 by WReach
5
votes
Any occurrence of the association key "correlation" at any depth of an expression will have a position index that matches the pattern {___, Key["correlation"]}. We can use either MapIndexed or Replac …
answered Nov 3 '16 by WReach
6
votes
result associations from scratch: <| Year -> #[Year], ID -> #[ID], tot -> #[amt1] + #[amt2] |> & /@ data (* {<| Year->2014, ID->1, tot->30 |>, <| Year->2015, ID->1, tot->45 |>, <| Year->2014, ID->2, tot->32 |>} *) …
answered Feb 2 '15 by WReach
15
votes
Mathematica 10.1 almost supports this operation directly: assoc // Query[Transpose] (* <| "a" -> <|"1" -> "x", "2" -> Missing["KeyAbsent", "a"]|>, "b" -> <|"1" -> "y", "2" -> "z"|>, "c" -> <|" …
answered Jun 21 '15 by WReach
6
votes
UPDATE The described behaviour is not a bug as DeleteMissing is explicitly listed as a descending operator in the documentation. See the response by @TaliesinBeynon. I will delete this response afte …
answered Sep 13 '14 by WReach
6
votes
This operation used to work back in v10.0 when the dataset type-checking was less aggressive, but has been broken since v10.1. The root cause is that the type inferencer cannot deduce the result type …
answered Nov 4 '16 by WReach
6
votes
Using MapIndexed: MapIndexed[{#, #2[[1, 1]]} &, dat] // Normal (* <|"a" -> {2, "a"}, "b" -> {"y", "b"}, "c" -> {{2, 3}, "c"}|> *)
answered Jan 23 '18 by WReach
6
votes
These are not functional solutions, but they are fairly concise owing to the "transparency" of associations to operators like Map and Exp: Module[{t = 0}, Map[t += # &, eg]] // Exp or Set: Module …
answered Mar 30 '17 by WReach
3
votes
, Infinity}] // Cases[{p___, Key[k1_], Key[k2_]} :> {RV[[p, k1, k2, "Math"]], k1, RV[[p, k1, "Name"]], k2}] This works by first locating the positions of all associations with a "Math" key … . It then looks upward at the two containing levels to obtain the context keys. This formulation makes the assumption that "Math" associations are always contained within outer associations of the …
answered Oct 17 '16 by WReach
5
votes
Perhaps this: Module[{i = 1}, dataset[All, <| #, "d" -> d[[i++]] |> &]]
answered Nov 4 '14 by WReach
2
votes
", "value2"}]]. It is not legal to use key names in spans since, in general, keys are not guaranteed to be in the same order within a list of associations. The pure function is set up to assume that the …
answered Jan 2 '15 by WReach
7
votes
Here is one way: ds[Merge[MemberQ[6]] /* Select[#&] /* Keys] It works as follows. First, we extract each unique key along with an indication as to whether its associated value is the target valu …
answered Feb 17 '15 by WReach
5
votes
Unfortunately, JoinAcross does not presently (V11.1) support any form of computed key specification. We have no choice but to adjust the first dataset to include the full name. We do not necessarily …
answered May 29 '17 by WReach
16
votes
The problem with the query proposed in the question is that it is attempting to apply Select to each row. As @Kuba points out in a comment, the use of Select is unnecessary. The query can be express …
answered Feb 16 '15 by WReach
7
votes
The problem occurs because the three-argument form of Lookup is not recognized by the type inferencing performed by Dataset. One work-around is to use Query directly, bypassing the type inferencing: …
answered Jun 7 '15 by WReach

15 30 50 per page