两个pandas的Series取交集 and and
两个pandas的Series取交集
Cannot merge a Series without a name
Series比较的时候,忽略index
index = pd.Series([True for _ in range(data_subset.shape[0])],index=data_subset.obs_names)
tmpindex = eval("data_subset.obs[\"{}\"] == \"{}\"".format(columnName, cellType))
index = index.eq(tmpindex)
需要保证index和tmpindex的 index是一样的
如何忽略index
data_subset = self.data index = pd.Series([False for _ in range(data_subset.shape[0])], index=data_subset.obs_names) count = 0 for key,value in self.colvalTwiDic.items(): if value.checkState(0) == Qt.Checked: print("key is {}".format(key)) columnName = key.split("$$")[0] cellType = key.split("$$")[1] tmpindex = eval("data_subset.obs[\"{}\"] == \"{}\"".format(columnName, cellType)) # index = index & tmpindex index 和 tmpindex 之间的关系应该是or index = pd.Series(index.values | tmpindex.values, index=data_subset.obs_names) count += 1