title: Take difference between two column of pandas dataframe based on condition in python
body: <p>I have a dataframe named pricecomp_df, I want to take compare the price of column "market price" and each of the other columns like "apple price","mangoes price", "watermelon price" but prioritize the difference based on the condition : <strong>(First priority is watermelon price, second to mangoes and third for apple)</strong>. The input dataframe is given below:</p>
  
  <pre><code>   code  apple price  mangoes price  watermelon price  market price
  0   101          101            NaN               NaN           122
  1   102          123            123               NaN           124
  2   103          NaN            NaN               NaN           123
  3   105          123            167               NaN           154
  4   107          165            NaN               177           176
  5   110          123            NaN               NaN           123
  </code></pre>
  
  <p>So here the first row has just apple price and market price then take their diff, but in second row, we have apple, mangoes price so i have to take only the difference between market price and mangoes price. likewise take the difference based on priority condition. Also skip the rows with nan for all three prices. Can anyone help on this? </p>