'How to efficiently update conditional set of columns in large dataframe

Given a large pandas data frame with columns Column_1 ... Column_n and a threshold X. What is an efficient way to set all subsequent columns to X once X is breached in each row. I.e. let's say we have threshold 1 and data frame the original dataframe is as in the link:

enter image description here

then the updated dataframe should be as in the second link:

enter image description here

Many thanks in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source