Home > OS >  How to print a graph with data from pandas?
How to print a graph with data from pandas?

Time:12-21

I got my data with .value_counts() and now I want to plot that and show the graph but with no success...

Here is my code:

new_list = df[['StudentID', ' Duration']]

new_list[' Duration'].value_counts().plot(kind='hist')

The code finishes without errors but my graph doesn't show? How do I do that?

CodePudding user response:

You should use matplotlib.pyplot library to show the graph.

this is example code.

from matplotlib import pyplot as plt

...
new_list = df[['StudentID', ' Duration']]
new_list[' Duration'].value_counts().plot(kind='hist')

plt.show()

CodePudding user response:

Now that we've created the plot, we need to display it, so we'll use the matplotlib.pyplot library's plt.show() method to see the graph.

  • Related