Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 274
Sandeep Kumar Kushwaha Avatar asked Dec 28 '25 16:12

Sandeep Kumar Kushwaha


1 Answers

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

like image 62
Jyoti yadav Avatar answered Dec 30 '25 04:12

Jyoti yadav



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!