How can we plot line-chart between repeating non-numeric column values in python, containing information of more than two columns?

Viewed 60

considering the database image attached below, suppose we have to plot x = TIME; y = Value; the plot should place countries in the graph for particular quarters and values. So there are there columns values interacting with each other. We are trying to represent countries in the axes of TIME and Value. I am trying to find an alternative without using one-hot encoding.

When trying to plot the data using this code:

x = x.sort_values(by = ['TIME'])
x[['TIME', 'Value']].plot(x="TIME", y = "Value", kind="bar")

The quarters are getting repeated in the x-axis. Can you explain how can we deal with such scenarios. the sample of dataset

1 Answers

One of the best solutions will be to convert the values using One-Hot encoding and then plot them.

Related