# 11.2 melt: wide मधून long

Source: https://ravindrabagale.com/mr/datascience/ch11-reshape-and-wide-long-data/11-2-melt-wide-to-long.html
Language: mr (Marathi with English technical terms)

City ओळख म्हणून ठेवू आणि महिन्यांचे columns rows मध्ये आणू:

long = wide.melt(id_vars="city", var_name="month", value_name="gmv")
long

Steps

मागच्या lesson मधला wide तयार करा.

long = wide.melt(id_vars="city", var_name="month", value_name="gmv") run करा.

long.sort_values(["city", "month"]) वापरून पाहा.

len(long) == 9 आहे का तपासा — 3 cities × 3 months.

Month text असल्याने साधं sorting alphabetical असेल. Calendar क्रम हवा असेल तर वेगळा month order ठरवा.

रवींद्र बागले यांची tip

id_vars मध्ये तीच माहिती ठेवा जी बदलू द्यायची नाही. var_name आणि value_name मुळे नवीन columns चा अर्थ स्पष्ट होतो.
