Add a new column to original f500 table

Hi all, we try to calculate the rank_change and add the new rank_change column to the original f500 table. Please see my understanding of the below code. I don’t understand step 3.

1, Take out all rows and all columns from f500 but only take rows that have no ‘NaN’ in the ‘previous_rank’ column. and assign the output to ‘Previously_ranked’
2, take ‘previous_rank’ column from table’previously_ranked’ subtract ‘rank’ column from table ‘previously_rank’, save the answers to ‘rank_change’
3,what is the logic here to add the ‘rank_change’ column to f500?

previously_ranked = f500.loc[f500[“previous_rank”].notnull(),:]
rank_change=previously_ranked[‘previous_rank’]-previously_ranked[‘rank’]
f500[‘rank_change’]=rank_change

Hi @candiceliu93

Not sure why your question got lost. :frowning:

Attaching the mission link would have helped for better clarity. So I am unsure if this would be any help.

Perhaps the idea behind this column will help us identify the companies which have shown a drastic change in their ranks. Like if a company jumps from 51th to 52nd or 49th, we can say the company’s performance was similar or close to the last year’s.

However, if a company ranks from 52nd to 39th we can say the company performed exceptionally better.