I hope you are all having a good day. I am using Datacamp to learn Python and the instructor provided code without explaining each line. There was very little explanation as well in previous lessons to allow us to think critically and understand it on our own. The code below is a function that takes a row of data, drops all missing values, and checks if all remaining values are greater than or equal to 0. Can someone break down line by line what is happening. I'm particularly confused by the [1:-1] aspect.
def check_null_or_valid(row_data): no_na = row_data.dropna()[1:-1] numeric = pd.to_numeric(no_na) ge0 = numeric >= 0 return ge0 assert g1800s.iloc[:, 1:].apply(check_null_or_valid, axis=1).all().all()