New answers tagged

0

You could alter the GroupBy to return the structure you desire. dReduced = d[ GroupBy["id"] /* Values , Transpose /* Query[{"id" -> First, Sequence @@ Thread[Range[2, 3] -> Total]}] /* KeyMap[Replace[k_String?(# != "id" &) :> k <> "_total"]] ] gives { <|"id" -> ...


0

For those who wants to use JoinAcross, I have slightly more verbose solution similar to @kglr's: FlattenAssociation[d_, keyName_] := MapThread[ Join[<|keyName -> #1|>, #2] &, {Keys[d] // Normal, Values[d] // Normal} ]; JoinAcross[Normal[d], FlattenAssociation[dReduced, "id"], Key["id"]] // Dataset; Or more: ...


1

I like this solution (without JoinAcross): MapJoin[rightDataset_, record_, key_] := Join[record, rightDataset[Key[record[key]]]]; d[All, MapJoin[Normal[dReduced], #, "id"] &] ```


1

Your Table expression works out of sheer luck, i.e. just because Table[f] simply returns f and Table does nothing there. Apart from that, here is an example of importing multiple sheets at once. It is unclear to me what you want to do with it next and how you want to merge them into a dataset, but I suspect that might turn out to actually not be necessary. ...


0

Here is another take on this issue. I was importing a nested JSON from an API call from the Homeland Infrastructure Foundation using the call below: tst = Import["https://services1.arcgis.com/Hp6G80Pky0om7QvQ/arcgis/rest/services/Electric_Power_Transmission_Lines/FeatureServer/0/query?where=1%3D1&outFields=*&geometry=-123.936%2C35.284%2C-90.559%...


Top 50 recent answers are included