I have a Pandas Series, s, and spliced it::
print(s)
A {B, A}
B {B, A , E}
C {B, C}
D {D, A}
E {B, E, C}
dtype: object
f = s.index
p = s.values
f is now a Pandas Index; p is a numpy array. I then strip the whitespaces.
I now want to 'cross-check', see which letters are in each row and column::
cross_check = (p[:, None] & [{x} for x in f]).astype(bool)
print(cross_check)
array([[ True, True, False, False, False],
[ True, True, False, False, True],
[False, True, True, False, False],
[ True, False, False, True, False],
[False, True, True, False, True]], dtype=bool)
This is great, but fails if the case doesn't match i.e. "B" is 'b' in the first row.
How do I perform the logic and be case-insensitive?? Thanks!!