Nikola Knežević
Nikola Knežević

Reputation: 35

How to print a graph with data from pandas?

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?

Upvotes: 0

Views: 500

Answers (2)

Kapil Musale
Kapil Musale

Reputation: 223

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.

Upvotes: 0

SEUNGFWANI
SEUNGFWANI

Reputation: 160

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()

Upvotes: 1

Related Questions