title: How do I make a histogram from a csv file which contains a single column of numbers in python?
body: <p>I have a csv file (excel spreadsheet) of a column of roughly a million numbers. I want to make a histogram of this data with the frequency of the numbers on the y-axis and the number quantities on the x-axis. I know matplotlib can plot a histogram, but my main problem is converting the csv file from string to float since a string can't be graphed. This is what I have:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import csv
  
  with open('D1.csv', 'rb') as data:
      rows = csv.reader(data, quoting = csv.QUOTE_NONNUMERIC) 
      floats = [[item for number, item in enumerate(row) if item and (1 &lt;= number &lt;= 12)] for row in rows]
  plt.hist(floats, bins=50)
  plt.title("histogram")
  plt.xlabel("value")
  plt.ylabel("frequency")
  plt.show()
  </code></pre>