1

df

SKU   A    B  Jan_Sales  Feb_Sales  Mar_sales Apr_sales  Dec_sales..
 A    AC   BA      122        100        50        200         300
 B    BC   BB      100        50         80        90          250
 C    CC   BC       40        30        100        10          11

and so on

Now I want a graph which will plot Jan sales, feb sales and so on till dec in one line for SKU A, Similarly one line on the same graph for SKU B and same way for SKU C. I want to drop columns A and B. I know how to do that using column name, but how can i do that using column number/position

df.set_index("SKU").drop(['A','B']).T.plot()

How to drop A and B using their position 1 and 2 in this case

1

1 Answer 1

1

Add DataFrame.iloc for remove first and second columns, here A and B:

df.set_index("SKU").iloc[:, 2:].T.plot()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.