Skip to content

Find ‘next’ non-null value in column

I am trying to create a new column which appends the row index of next non-null value next to the current non-null value using the following df as a starting point: The output would look like this: I have found a link that touches on the issue but I could not adapt to suit.. How can I get the index

call variable in method within the same class

In this example code: is there a way to call the average and total variables in the math method without putting it in the return function (I want the math function to only return the length of the list)? I tried this: but this gives an error. I want to be able to call the variables in one line. Any