JoinAcross[{a1,a2,…},{b1,b2,…},keyspec]
gives a list of associations obtained by joining those pairs of associations ai and bj in which the values specified by keyspec match.
JoinAcross[tab1,tab2,keyspec]
joins two tabular objects according to keyspec.
JoinAcross[prefix1obj1,prefix2obj2,keyspec]
prefixes the keys in obji with prefixi using ExtendedKey[prefixi,ckeyij].
JoinAcross[alist,blist,keyspec,"joinspec"]
uses joinspec to determine when to allow associations that contain missing elements to be generated.
JoinAcross
JoinAcross[{a1,a2,…},{b1,b2,…},keyspec]
gives a list of associations obtained by joining those pairs of associations ai and bj in which the values specified by keyspec match.
JoinAcross[tab1,tab2,keyspec]
joins two tabular objects according to keyspec.
JoinAcross[prefix1obj1,prefix2obj2,keyspec]
prefixes the keys in obji with prefixi using ExtendedKey[prefixi,ckeyij].
JoinAcross[alist,blist,keyspec,"joinspec"]
uses joinspec to determine when to allow associations that contain missing elements to be generated.
更多信息和选项
- JoinAcross[{a1,a2,…},{b1,b2,…},keyspec] effectively implements the analog of SQL JOIN, joining two tables with rows ai and bj across columns specified by keyspec.
- In JoinAcross[{a1,a2,…},{b1,b2,…},keyspec], keyspec can be one of the following:
-
key join ai and bj, when the value associated with key is the same {key1,key2,…} all the values associated with each keyi need to be the same in each matched pair keyakeyb the value associated with keya in ai must be the same as the value associated with keyb in bj {keya1keyb1,keya2keyb2,…} match the value associated with keyai in ai with the value associated with keybj in bj func join the pairs ai, bj whenever func[ai,bj] is True - In JoinAcross[{a1,a2,…},{b1,b2,…},keyspec], keyspec can effectively be replaced by the following functions:
-
key #1[key]===#2[key]& {key1,key2,…} #1[key1]===#2[key1]&[key2]===#2[key2]&&…& keyakeyb #1[keya]===#2[key2]& {keya1keyb1,keya2keyb2,…} #1[keya1]===#2[keyb1]&[keya2]===#2[keyb2]&&…& - 除非是字符串,否则 JoinAcross 中的键值指定必须封装在 Key 中.
- JoinAcross 实际上产生 Flatten[Outer[Join,alist,blist]] 的过滤版本.
- 默认情况下,JoinAcross 在 SQL 语句中进行“内连接”.
- "joinspec" 的下列格式指定相关性对 ai、bj 的不同行为:
-
"Inner" 只保持数值匹配的 ai、bj(默认) "Left" 允许找不到匹配的 bj 的 ai "Right" 允许找不到匹配的 aj 的 bi "Outer" 允许 ai 和 bj 都不匹配 - 当不出现相应的数值时,Missing["Unmatched"] 用于相应位置.
- JoinAcross[{a1,…},{b1,…},{},"joinspec"] and JoinAcross[{a1,…},{b1,…},True&,"joinspec"] are effectively the same as Outer[Join,{a1,…},{b1,…}]. Since all ai match all bj, the "joinspec" is ignored.
- 可以给出选项 KeyCollisionFunction 以指定如何处理未指定连接的 ai 和 bj 元素,但是具有相同的键.
- KeyCollisionFunction 的可能设置包括:
-
None 删除两个元素 Left 只包含左元素(默认) Right 只包含右元素 func 应用 func 以产生一对新键
范例
打开所有单元 关闭所有单元基本范例 (10)
Do the same using Tabular objects:
Use a function to find posthumous works:
Use rules to avoid key collisions:
范围 (1)
JoinAcross works with SQL-backed Tabular objects:
选项 (3)
When a matching key b is not used for joining, pick the left value for this key by default:
Use KeyCollisionFunction to specify which value of the colliding key should be returned:
应用 (1)
属性和关系 (2)
In some cases, JoinAcross can be rewritten as ColumnwiseCombine:
JoinAcross is equivalent to CombinedEntityClass:
相关指南
-
▪
- 关联 ▪
- 计算结构化数据集 ▪
- 表格转换 ▪
- 数据集上的类数据库操作
相关链接
文本
Wolfram Research (2014),JoinAcross,Wolfram 语言函数,https://reference.wolfram.com/language/ref/JoinAcross.html (更新于 2015 年).
CMS
Wolfram 语言. 2014. "JoinAcross." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2015. https://reference.wolfram.com/language/ref/JoinAcross.html.
APA
Wolfram 语言. (2014). JoinAcross. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/JoinAcross.html 年
BibTeX
@misc{reference.wolfram_2025_joinacross, author="Wolfram Research", title="{JoinAcross}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/JoinAcross.html}", note=[Accessed: 30-October-2025]}
BibLaTeX
@online{reference.wolfram_2025_joinacross, organization={Wolfram Research}, title={JoinAcross}, year={2015}, url={https://reference.wolfram.com/language/ref/JoinAcross.html}, note=[Accessed: 30-October-2025]}