0

I have a dataframe that looks like this

     name     age
0    bob      10
1    sal      5
2    NaN      22

Row 2 in the Name column is null, so I want to replace the NaN value with the previous value, in this case Sal, so my result would look like this:

     name     age
0    bob      10
1    sal      5
2    sal      22

Here is what I'm currently playing with:

for index,row in dataframe.head().iterrows():
     if open_first_page.isnull(open_first_page["name"]):
          print("hi")

I can't get the isnull function to even work though. Any suggestions? Once I get that recognized, I'll see if I can grab the previous value somehow.

Side Note: What I'm doing might seem odd, but I'm doing some ETL via Python, so it works with what I am doing.

0 Answers0