How do I make a histogram from a csv file which contains a single column of numbers in python?
Question: 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:

    
    
    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 <= number <= 12)] for row in rows]
    plt.hist(floats, bins=50)
    plt.title("histogram")
    plt.xlabel("value")
    plt.ylabel("frequency")
    plt.show()
    


Answer: You can do it in one line with [pandas](http://pandas.pydata.org):

    
    
    import pandas as pd
    
    pd.read_csv('D1.csv', quoting=2)['column_you_want'].hist(bins=50)
    

