When creating a data frame, declare dtype=object:
In [1013]: df = pd.DataFrame({
...: 1: [1, 2],
...: 2: ['a', 3],
...: 3: [None, 7]
...: }, dtype=object)
In [1014]: df
Out[1014]:
1 2 3
0 1 a None
1 2 3 7
Now you can compare without transposing:
In [1015]: df == 'a'
Out[1015]:
1 2 3
0 False True False
1 False False False
I am convinced that to begin with, your columns are not objects (they are used forcibly wherever possible), but transposition forces a change due to mixed values.
This is detected in the source code pandas/internals.py:
if not isinstance(result, np.ndarray):
...
raise TypeError('Could not compare [%s] with block values' %
repr(other))
dtype , .