I have a dataframe which looks like this
pd.DataFrame({'A': ['C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7'],
...: 'x': [2, 2, 3, 2, 3, 1, 3],
...: 'maxValue_1': [2, 1, 2, 3, 4, 2, 1]})
Out[7]:
A x maxValue_1
0 C1 2 2
1 C2 2 1
2 C3 3 2
3 C4 2 3
4 C5 3 4
5 C6 1 2
6 C7 3 1
maxValue_2 = 2
I need to check whether column 'x' is equal or greater than the max(df.maxValue_1, maxValue_2)
Resulting dataframe should look like this.
A x maxValue_1 result
0 C1 2 2 True
1 C2 2 1 True
2 C3 3 2 True
3 C4 2 3 False
4 C5 3 4 False
5 C6 1 2 False
6 C7 3 1 True
How can I code this in an efficient manner without having to add variable 'maxValue_2' to the dataframe?