【发布时间】:2019-02-12 16:26:27
【问题描述】:
我创建了以下字典 test,由 Series 对象组成:
test = {
'A': pd.Series([True, False, True]),
'B' : pd.Series([True,False,False])
}
我想执行test['A'] & test['B']。我的问题是我想对字典中任何可能数量的键进行按位加法。 (即它可以是'A' 或'A' and 'B' 或'A' and 'B' and 'C' 等)。在任何情况下,每个键的值都具有相同的长度,并且所有的Series 都是布尔值。
【问题讨论】:
-
为什么不使用 DataFrame?
-
问题:您是要按位执行 KEYS 还是实际执行 VALUES?当我按位读取 KEYS 时,我的字面意思是:'A' | 'B'
标签: python pandas dictionary series bitwise-and