Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python histogram as a dictionary

    def dict_histogram(lst):
        hist = {}
        for x in lst:
            if x in hist:
                hist[x] += 1
            else:
                hist[x] = 1
        return hist
 
PREVIOUS NEXT
Tagged: #python #histogram #dictionary
ADD COMMENT
Topic
Name
4+1 =