I am trying to draw a frequency line plot using matplotlib with the x-axis being the amount (loan_amount) and the y-axis the number of occurrences of that amount (loan_count) but I am not sure how to use the number of occurrences as y-values.
I'd think the general code has to start similar to this but am not sure what y should be and how to complete it:
con = sqlite3.connect('databaseTest.db')
cur = con.cursor()
cur.execute("SELECT LOAN_AMOUNT FROM funded")
loan_amount = cur.fetchall()
loan_amount_list = [i[0] for i in loan_amount]
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
x = loan_amount_list
I want the final plot to look like this:
Any help is much appreciated! Thanks!
-- Edit:
Implementing the counter function from collections as suggested below leads to the following plot which is not what I am aiming for:



