Skip to content

Instantly share code, notes, and snippets.

@bibscy
Created July 14, 2020 12:18
Show Gist options
  • Save bibscy/5aa0d1cba753773bb88d1929a819309e to your computer and use it in GitHub Desktop.
Save bibscy/5aa0d1cba753773bb88d1929a819309e to your computer and use it in GitHub Desktop.
#check total number of males
totalMales = newDF.loc[(newDF.Gender=='Male')].count() #409
print("totalMales" + str(totalMales))
totalFemales = newDF.loc[(newDF.Gender=='Female')].count() #77
print("totalFemales" + str(totalFemales))
#males are more likely to borrow than females 409 > 77
plt.style.use('ggplot')
x = ['Males', 'Females']
y = [totalMales, totalFemales]
x_pos = [i for i, _ in enumerate(x)]
plt.bar(x_pos, y, color='green')
plt.xlabel("Gender")
plt.ylabel("Total who Paid Off")
plt.title("Number of Males vs Females who Paid Off")
plt.xticks(x_pos, x)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment