Skip to content

Problem set #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added ProblemSet1_Yu.pdf
Binary file not shown.
692 changes: 692 additions & 0 deletions ProblemSet2_Yu.ipynb

Large diffs are not rendered by default.

Binary file added ProblemSet3/Distribution_of_CL.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ProblemSet3/ProblemSet3_Yu.pdf
Binary file not shown.
35 changes: 35 additions & 0 deletions ProblemSet3/ProblemSet3_Yu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import plotly.express as ex

# Read in data from csv file
df = pd.read_csv('BankChurners.csv',sep=',')

data_CA = df['Credit_Limit']

# hist distribution of Credit line
plt.hist(data_CA, bins = 20, edgecolor = 'black')

plt.ylabel('Number of customer in this credit line interval')
plt.xlabel('Credit line')
plt.title('Distribution of credit line')

plt.savefig('Distribution_of_CL')

# show the distribution of gender
import plotly.io as pio
fig1 = ex.pie(df,names='Gender',title='Distribution of gender')
pio.write_image(file='gender.png',fig = fig1)

# show the distribution of credit line for male and female customers
data_CA_M = df[df['Gender']=='M']['Credit_Limit']
data_CA_F = df[df['Gender']=='F']['Credit_Limit']

kwargs = dict(histtype='stepfilled', alpha = 0.3, bins=20)
plt.hist(data_CA_M, **kwargs, color='g')
plt.hist(data_CA_F, **kwargs, color='r')
plt.legend(['male','female'])
plt.title('Distribution of credit line for male and female')
plt.savefig('Distribution_of_CreditLine_Gender')

Binary file added ProblemSet3/gender.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading