Skip to main content
deleted 100 characters in body
Source Link
egwene sedai
  • 2.4k
  • 16
  • 24

Different from your approach, here I first constructDefine a new tablefunction dsblookup by appending a column ("B") to look up the dsB, whose value is obtained from ds2 via the ID key:

lookup[x_] := Query[SelectFirst[#ID == x &], "B"]@ds2
dsb =

then replace the missing values,

SortBy["ID"]@ds3[All, SortBy["ID"]@ds[All<|#,"B" Append[#-> Replace[#B, "B"Missing["Unmatched"] -> lookup[#ID]]lookup[#ID]]|> &]

enter image description here

you may then join this with or just lookup the B value in all rows of ds3 from ds2:,

SortBy["ID"]@JoinAcross[dsbSortBy["ID"]@ds3[All, ds2<|#, {"ID","B" "Date"},-> "Outer"]lookup[#ID]|> &]

enter image description hereenter image description here

Different from your approach, here I first construct a new table dsb by appending a column ("B") to ds, whose value is obtained from ds2 via the ID key:

lookup[x_] := Query[SelectFirst[#ID == x &], "B"]@ds2
dsb = SortBy["ID"]@ds[All, Append[#, "B" -> lookup[#ID]] &]

enter image description here

you may then join this with ds2:

SortBy["ID"]@JoinAcross[dsb, ds2, {"ID", "Date"}, "Outer"]

enter image description here

Define a function lookup to look up the B value from ds2 via the ID key:

lookup[x_] := Query[SelectFirst[#ID == x &], "B"]@ds2

then replace the missing values,

SortBy["ID"]@ds3[All, <|#,"B" -> Replace[#B, Missing["Unmatched"] -> lookup[#ID]]|> &]

or just lookup the B value in all rows of ds3 from ds2,

SortBy["ID"]@ds3[All, <|#, "B" -> lookup[#ID]|> &]

enter image description here

deleted 3 characters in body
Source Link
egwene sedai
  • 2.4k
  • 16
  • 24

Slightly differentDifferent from your approach, here I first construct a new table dsb by appending a column ("B") to ds, whose value is obtained from ds2 via the ID key:

lookup[x_] := Query[SelectFirst[#ID == x &], "B"]@ds2
dsb = SortBy["ID"]@ds[All, Append[#, "B" -> lookup[#ID]] &]

enter image description here

you may then join this with ds2:

SortBy["ID"]@JoinAcross[dsb, ds2, {"ID", "Date"}, "Outer"]

enter image description here

Slightly different from your approach, here I construct a new table dsb by appending a column ("B") to ds, whose value is obtained from ds2 via the ID key:

lookup[x_] := Query[SelectFirst[#ID == x &], "B"]@ds2
dsb = SortBy["ID"]@ds[All, Append[#, "B" -> lookup[#ID]] &]

enter image description here

you may then join this with ds2:

SortBy["ID"]@JoinAcross[dsb, ds2, {"ID", "Date"}, "Outer"]

enter image description here

Different from your approach, here I first construct a new table dsb by appending a column ("B") to ds, whose value is obtained from ds2 via the ID key:

lookup[x_] := Query[SelectFirst[#ID == x &], "B"]@ds2
dsb = SortBy["ID"]@ds[All, Append[#, "B" -> lookup[#ID]] &]

enter image description here

you may then join this with ds2:

SortBy["ID"]@JoinAcross[dsb, ds2, {"ID", "Date"}, "Outer"]

enter image description here

added 197 characters in body
Source Link
egwene sedai
  • 2.4k
  • 16
  • 24

Slightly different from your approach, here I construct a new table dsb by appending a column ("B") to ds, where thewhose value is looked upobtained from ds2 via the ID key:

lookup[x_] := Query[SelectFirst[#ID == x &], "B"]@ds2
dsb = SortBy["ID"]@ds[All, Append[#, "B" -> lookup[#ID]] &]

enter image description here

you may then join this with ds2:

SortBy["ID"]@JoinAcross[dsb, ds2, {"ID", "Date"}, "Outer"]

enter image description here

Slightly different from your approach, here I construct a new table by appending a column ("B") to ds, where the value is looked up from ds2 via ID:

lookup[x_] := Query[SelectFirst[#ID == x &], "B"]@ds2
SortBy["ID"]@ds[All, Append[#, "B" -> lookup[#ID]] &]

enter image description here

Slightly different from your approach, here I construct a new table dsb by appending a column ("B") to ds, whose value is obtained from ds2 via the ID key:

lookup[x_] := Query[SelectFirst[#ID == x &], "B"]@ds2
dsb = SortBy["ID"]@ds[All, Append[#, "B" -> lookup[#ID]] &]

enter image description here

you may then join this with ds2:

SortBy["ID"]@JoinAcross[dsb, ds2, {"ID", "Date"}, "Outer"]

enter image description here

Post Undeleted by egwene sedai
Post Deleted by egwene sedai
Source Link
egwene sedai
  • 2.4k
  • 16
  • 24
Loading