This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import statsmodels.api as sm | |
| import numpy as np | |
| #read in clean loan data | |
| df = pd.read_csv('loansData_clean.csv') | |
| #create column to highlight interest rates below 12% | |
| df['IR_TF'] = df['Interest.Rate'] > .12 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import statsmodels.api as sm | |
| import numpy as np | |
| #read in clean loan data | |
| df = pd.read_csv('loansData_clean.csv') | |
| #create column to highlight interest rates below 12% | |
| df['IR_TF'] = df['Interest.Rate'] > .12 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import statsmodels.api as sm | |
| df = pd.read_csv('loansData_clean.csv') | |
| df['IR_TF'] = df['Interest.Rate'] > .12 | |
| df['IR_TF'] = df['IR_TF'].map(lambda x: 1 if x == True else 0) | |
| df['Statsmodel.Intercept'] = df['Interest.Rate'].map(lambda x: 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| import statsmodels.api as sm | |
| loansData = pd.read_csv('https://github.com/Thinkful-Ed/curric-data-001-data-sets/raw/master/loans/loansData.csv') | |
| #Remove '%' from 'Interest.Rate' column and contert to number | |
| loansData['Interest.Rate']=loansData['Interest.Rate'].map(lambda x: round(float(x.rstrip('%')) / 100, 4)) | |
| #Remove 'months' from the 'Loan.Length' column |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scipy import stats | |
| import collections | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| loansData = pd.read_csv('https://github.com/Thinkful-Ed/curric-data-001-data-sets/raw/master/loans/loansData.csv') | |
| loansData.dropna(inplace=True) | |
| freq = collections.Counter(loansData['Open.CREDIT.Lines']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.pyplot as plt | |
| import pandas as pd | |
| import scipy.stats as stats | |
| loansData = pd.read_csv('https://github.com/Thinkful-Ed/curric-data-001-data-sets/raw/master/loans/loansData.csv') | |
| loansData.dropna(inplace=True) | |
| loansData.boxplot(column='Amount.Requested') | |
| plt.savefig('Amount Requested Boxplot.png') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import scipy.stats as stats | |
| import collections | |
| import matplotlib.pyplot as plt | |
| x = [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 4, 4, 5, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9] | |
| c = collections.Counter(x) | |
| count_sum = sum(c.values()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sqlalchemy import create_engine | |
| from sqlalchemy import Column, Integer, String, ForeignKey, DateTime | |
| from sqlalchemy.orm import sessionmaker | |
| from sqlalchemy.orm import relationship | |
| from sqlalchemy.ext.declarative import declarative_base | |
| engine = create_engine('postgresql://ubuntu:thinkful@localhost:5432/tbay') | |
| Session = sessionmaker(bind=engine) | |
| session = Session() | |
| Base = declarative_base() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #modeling the bicycle industry | |
| #classes | |
| class bicycle(object): | |
| #create the bicycle class so that each bike created has a model name, weight, and cost to produce | |
| def __init__(self, model, weight, cost): | |
| self.model = model | |
| self.weight = weight | |
| self.cost = cost |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #modeling the bicycle industry | |
| #create the customer class | |
| class customer(object): | |
| def __init__(self, name, fund): | |
| self.name = name | |
| self.fund = fund | |
| #create the bicycle class so that each bike created has a model name, weight, and cost to produce | |
| class bicycle(object): |