我正在尝试将 DataFrame A 内部连接到 DataFrame B 并且遇到错误。
这是我的加入声明:
merged = DataFrameA.join(DataFrameB, on=['Code','Date'])
这是错误:
ValueError: len(left_on) must equal the number of levels in the index of "right"
我不确定列顺序是否重要(它们并不是真正“有序”的,不是吗?),但为了以防万一,DataFrame 的组织方式如下:
DataFrameA: Code, Date, ColA, ColB, ColC, ..., ColG, ColH (shape: 80514, 8 - no index)
DataFrameB: Date, Code, Col1, Col2, Col3, ..., Col15, Col16 (shape: 859, 16 - no index)
我需要更正我的 join 语句吗?或者是否有另一种更好的方法来获取这两个 DataFrame 的交集(或内部联接)?