1

Ive got a Counter which currently I print out a long list of each word and its corresponding frequency of occurrence using the following:

from collections import Counter
import matplotlib.pyplot as plt
import pandas as pd
data = []
with open('csv.csv') as f:
    data = [word for row in csv.reader(f) for word in row[1].lower().split()]
counts = Counter(data)

for value, count in counts.most_common():
    print(value, count)

I would like to view the data instead in either a scatter plot or bar chart format. The issue I have with the solution Using Counter() in Python to build histogram? is that it throws an error about not all my strings being unicode and just shows one bar of maximum length.

Stussy
  • 61
  • 1
  • 7
  • Too broad question :o You could do this in so many ways. Try looking at gnuplot, highcharts, plotly, etc. – pawamoy Mar 28 '18 at 14:19
  • What is input, script and error message in this case? Which part doesn't like the string and why? Without this information, you will only get generic answers. – Mr. T Mar 28 '18 at 19:21

0 Answers0