How to make graph using python after making a filtered data frame?

时间:2019-04-08 14:05:31

标签: python-3.7

I have made a new data frame based on values I want. Now, I want to graph it using matplotlib

#I want to create a data frame where only the target column shows 1 istarget = data[data.target == 1]

#Then, I want to see the distribution of the age profile istarget.age.value_counts()

This is my output, but I don't know what is my next step to graph it:

I want my X-axis to be the Age, and the Y-axis to be the count. It will be extremely helpful if I can bucketize the data in age groups of 5 as well (e.g. 26 to 30, 31 to 35...)

Age Count 41 9 51 9 52 9 44 8 42 7 57 7 58 7 53 6 45 6 64 6 59 5 43 5 56 5 48 4 62 4 46 4 65 4 66 4 50 4 60 3 71 3 67 3 47 3 49 3 63 3 55 3 39 3 35 2 37 2 68 2 69 2 34 2 38 2 76 1 40 1 74 1 61 1 70 1 29 1 Name: age, dtype: int64

0 个答案:

没有答案