pandas/melt-default-names
| Rule | melt-default-names |
|---|---|
| Pack | pandas |
| Severity | info |
| Fix | none, edit by hand |
| Library versions | every version |
melt without var_name names the column of old column names variable, which says nothing about them. Name it with var_name, and name the values with value_name.
long = df.melt(id_vars="id")long = df.melt(id_vars="id", var_name="year", value_name="sales")What the rule reports
Section titled “What the rule reports”The rule reports melt without var_name, which names the column of old column names variable. The column of their values is named value unless the call passes value_name.
How to fix it
Section titled “How to fix it”xpd has no automatic fix, so make the change by hand.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
melt without var_name calls the column of old column names "variable", which does not say what they are. Name it, as in var_name="year", and name the values with value_name=.Browse the other rules of the pandas pack.