🔥✅[Pandas] A very short and simple solution✅🔥
Approach\n Describe your approach to solving the problem. \npandas.melt lets you unpivot a table. This means that you\'ll turn your wide table into a long (and 
# Approach\n<!-- Describe your approach to solving the problem. -->\n*pandas.melt* lets you unpivot a table. This means that you\'ll turn your wide table into a long (and narrow) table. In other words, all the store columns (store1, store2, store3) will be put into a single  column. The values contained in these columns will also be put into a single new column.\n\n1. You\'ll start off with *df = ( ..... )*, which let\'s you save the output in a new DataFrame.\n2. The *products.melt( ..... )* function lets you unpivot the table (go from wide to long).\n3. Then you\'ll name the column(s) which you want to leave unchanged, in this case \'product_id\'.\n4. Next you\'ll name the columns you want to unpivot (go from wide to long).\n5. Then you\'ll name this new long column.\n6. Finally, you\'ll name the column in which all the values of the store columns are put.\n7. To get rid of the null values, you\'ll use *.dropna()*.\n\nIf you like this solution, **please upvote**!\n\n# Code\n```\nimport pandas as pd\n\ndef rearrange_products_table(products: pd.DataFrame) -> pd.DataFrame:\n    # 1. Saves output in new DataFrame\n    df = (\n        # 2. .melt() lets you unpivot the table\n        products.melt(\n            # 3. Columns you want to leave unchanged\n            id_vars = [\'product_id\'],\n            # 4. Columns you want to unpivot\n            value_vars = [\'store1\', \'store2\', \'store3\'], \n            # 5. This names the store column\n            var_name = \'store\',\n            # 6. This names the price column\n            value_name = \'price\'\n            )\n        # 7. .dropna() lets you drop the null values\n        .dropna() \n    )\n    return df\n```
['Pandas']