Python Forum
Histogram using pandas dataframe not showing proper output
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Histogram using pandas dataframe not showing proper output
#1
I am doing coding in script mode :
import pandas as pd
ontutD = {'Tutor': ['Tahira','Gagan','Anusha','Jacob','venkat',
                    'Tahira','Gagan','Anusha','Jacob','venkat',
                    'Tahira','Gagan','Anusha','Jacob','venkat',
                    'Tahira','Gagan','Anusha','Jacob','venkat'],
          'Classes' : [28,36,41,32,40,36,40,36,40,46,24,30,44,40,32,36,32,36,42,38],
          'Quarter' : [1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4],
          'Country' : [ 'USA','UK','Japan','USA','Brazil','USA','USA','Japan',
                        'Brazil','USA','Brazil','USA','UK','Brazil','USA','Japan',
                        'Japan','Brazil','UK','USA']
          }
df1 = pd.DataFrame(ontutD)
ks = df1.hist(column='Classes')

print (ks)
but it is showing some message in output window without viewing graphical histogram.
Output:
[[<matplotlib.axes._subplots.AxesSubplot object at 0x06B0E9D0>]]
why it is not showing graphical histogram in output ?
Reply
#2
You need to call matplotlib's show function, e.g.

import matplotlib.pyplot as plt
plt.show() # call this function after the hist was created.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Need help with NumPy Histogram function coding Triikey 1 916 May-15-2023, 01:45 PM
Last Post: deanhystad
  Pandas dataframe indexing pythonNovice 1 989 Jun-16-2022, 04:43 PM
Last Post: jefsummers
  Plotting histogram of dataframe column Mark17 4 2,618 Jul-30-2020, 09:52 AM
Last Post: Mark17
  Can someone find out what kind of histogram is it? J_tin 1 1,778 Apr-26-2020, 05:23 PM
Last Post: buran
  How can I convert specific rows from excel to pandas dataframe? mcva 1 1,795 Apr-20-2020, 09:14 AM
Last Post: pyzyx3qwerty
  typeerror, building histogram from data newatpython11 7 3,757 Jul-17-2019, 12:54 PM
Last Post: ichabod801
  Histogram and text file. pawlo392 1 4,113 May-24-2019, 03:14 AM
Last Post: heiner55
  how do i use get for my histogram function? pseudo 4 4,789 Oct-14-2018, 04:23 AM
Last Post: stullis
  tip calculator not displaying proper dollar format Crackity 15 8,859 Sep-04-2017, 11:15 AM
Last Post: syogun
  pandas dataframe next rows value metalray 2 10,138 Mar-06-2017, 11:31 AM
Last Post: metalray

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020