'pandas first_valid_index() in a vectorized way

this bit of code is a part of a while loop in which I change the values of the "value_area" variables, so executing this for loop can be quite long, is there a way to use the .first_valid_index() across all the DataFrame?

a = [value_area[remaining_index][x].sort_index(ascending=False).first_valid_index() for x in value_area[remaining_index].columns]


Sources

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

Source: Stack Overflow

Solution Source