0

I have a data set that has the following columns. funciton: pd.melt() years name date m1 m2 m3 m4 m5 m6 …. to m12

I set me variable name to month and try to include m1-m12, but I just cant get it to work. it will instead put everything in the new week column which looks like week year name date m1 m2 I don't want the week year name date, is there a way to just put m1-m12 in like indexing? i have tried it it didn't work

1 Answers1

0

sample output
month
m1
m2
m3
...
m12
here is the answer i come up with using iloc!
sorry for asking a easy question that I can figure out myself
pd.melt(.......value_vars=billboard.iloc[-12:])

  • Kindly mark it as accepted or delete the question, so it is no longer an active question – sammywemmy Apr 25 '22 at 00:35
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 25 '22 at 00:55
  • hi! how do i do that? – Jenwei Tan Apr 26 '22 at 01:32