I have a dataframe that looks like this:
df = pd.DataFrame({'a':[1,0,1],'b':[0,1,0],'b1':[1,0,0],'c':[0,1,1]})
df.columns = ['a','b','b','c']
>>> df
a b b c
0 1 0 1 0
1 0 1 0 1
2 1 0 0 1
I want to merge those two different b columns together, like this:
a b c
0 1 1 0
1 0 1 1
2 1 0 1
I understand that I could use | (OR) in a bitwise context to combine them, e.g. with a and c:
>>> df['a'] | df['c']
0 1
1 1
2 1
dtype: int64
But I'm having trouble selecting the two individual b columns, because of this:
>>> df['b']
b b
0 0 1
1 1 0
2 0 0
>>> df['b']['b']
b b
0 0 1
1 1 0
2 0 0
>>> df['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']['b']
b b
0 0 1
1 1 0
2 0 0