text_html_output_1.png
from pandasql import sqldf

resale = sqldf('SELECT category,sell_value, buy_value from df_items')
resale = resale.dropna()
resale['resale'] = resale['sell_value'] / resale['buy_value'] * 100
resale_categories = sqldf('SELECT category, AVG(resale) AS avg_resale from resale GROUP BY category ORDER BY avg_resale DESC')
resale_categories