Using pandas built-in melt method
Intuition\nRefer here for documentation of melt\n\n\n# Code\n\nimport pandas as pd\n\ndef rearrange_products_table(products: pd.DataFrame) -> pd.DataFrame:\n   
# Intuition\nRefer here for documentation of [melt](https://pandas.pydata.org/docs/reference/api/pandas.melt.html)\n\n\n# Code\n```\nimport pandas as pd\n\ndef rearrange_products_table(products: pd.DataFrame) -> pd.DataFrame:\n    melted_df = products.melt(id_vars=\'product_id\', var_name=\'store\',value_name=\'price\')\n    melted_df = melted_df.dropna()  # Drop rows with missing prices\n    return melted_df\n\n```
['Pandas']