pandasdataframehistogramcpu-wordfrequency-distribution

How do I create a histogram from a pandas dataframe?


I have the following pandas dataframe:

enter image description here

What is the best way to plot the word frequencies? I wanted to plot a histogram of the frequencies, it doesn't seem to work. Does anyone know how to get a histogram from here?


Solution

  • Use plot.bar:

    import matplotlib.pyplot as plt
    
    df.set_index('words').plot.bar(rot=45)
    plt.tight_layout()
    plt.show()
    

    histogram