Home > database >  how to plot duplicated columns on python pandas
how to plot duplicated columns on python pandas

Time:01-28

i have this data where the year column is duplicated for every month from 2018 to 2022 i want to plot the ORDNUM on monthly basis with year as my legend

the data frame view of it

CodePudding user response:

The following code generates the following picture.

import pandas as pd
import matplotlib.pyplot as plt
import seaborn

data = pd.DataFrame({"Year": [2018, 2018, 2018, 2019], "Month": [3, 4, 5, 3], "ORDNUM": [4459, 2332, 1224, 4322]})

seaborn.relplot(data=data, x="Month", y="ORDNUM", hue="Year")

plt.show()

enter image description here

  •  Tags:  
  • Related