Hi @DishinGoyani,
Thanks for the reply. I just had another question about this (I’m not really understanding this mission).
What does previously_ranked["rank"] mean? Why do we put “rank” in brackets when the variable, previously_ranked has “previous_rank” in it? Like I said, I’m just really confused about this.
# f500.loc[f500.loc[:,"previous_rank"].notnull()] break-down into 2 line for understanding
# 1st
# This is to filter-out null values from column `previous_rank`
# Will return `Series` containing `True` where value is null otherwise `False`
bool_idx = f500["previous_rank"].notnull()
# 2nd
# Now use above boolean index `bool_idx` to get rows from `f500` dataframe that has non-null values.
# Will return dataframe; `previously_ranked` is same as `f500` but with only non-null values
previously_ranked = f500[bool_idx]
# Here we are subtracting `rank` column from the `previous_rank` column of `previously_ranked` dataframe.
# It will store difference between `previous_rank` and `rank` as series
rank_change = previously_ranked["previous_rank"] - previously_ranked["rank"]
# At last adding new column to original dataframe `f500`
f500["rank_change"] = rank_change
Hi @DishinGoyani!
Good news, I think I understand now since you broke it up into two steps above. Bad news…one more question! You piqued my interest when you said series. Why couldn’t we do this: