'Is there a way to repeat row values in a column in pandas? [duplicate]

My column looks like this:

XXXXXXXX
     NaN
     NaN
     NaN
YYYYYYYY
     NaN
     NaN
     NaN

Instead of NaN i want to repeat row value untill next value and so on.

XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
YYYYYYYY
YYYYYYYY
YYYYYYYY
YYYYYYYY


Sources

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

Source: Stack Overflow

Solution Source