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 numpy as np | |
import matplotlib.pyplot as plt | |
from random import randint | |
from sklearn.neighbors import NearestNeighbors | |
import math | |
import random | |
#Read in data |
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 | |
from sklearn.naive_bayes import GaussianNB | |
#I kept getting this error 'pandas.io.common.CParserError: Error tokenizing data. C error: Expected 1 fields in line 104, saw 3' | |
#when trying to read in the data from GitHub so I just copied the data into a csv file and saved it locally | |
df = pd.read_csv('ideal_weight.csv') | |
#Remove single '' from coulmn names | |
df.rename(columns=lambda x: x.replace("'", ""), inplace=True) |
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 numpy as np | |
from sklearn.ensemble import RandomForestClassifier | |
import sklearn.metrics as skm | |
import pylab as pl | |
#Read in the column names for the dataset | |
feat = pd.read_csv('features.txt', delim_whitespace=True, header=None, index_col=False) | |
#Name the columns to isolate all dataset column names in one 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
import pandas as pd | |
import numpy as np | |
from sklearn.model_selection import KFold | |
import statsmodels.api as sm | |
import statsmodels.formula.api as smf | |
from sklearn.metrics import mean_squared_error | |
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 |
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 statsmodels.formula.api as smf | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import statsmodels.api as sm | |
from sklearn.metrics import mean_squared_error | |
#Set seed for reproducable results (what does this mean?) | |
np.random.seed(414) |
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 bs4 import BeautifulSoup | |
import requests | |
import pandas as pd | |
import sqlite3 as lite | |
import csv | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import statsmodels.api as sm |
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 requests | |
import sqlite3 as lite | |
import time | |
import datetime | |
import collections | |
import pandas as pd | |
#Cities to analyze | |
cities = {"Los_Angeles": "34.0522,-118.2437", | |
"Miami": "25.7617,-80.1918", |
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 requests | |
from pandas.io.json import json_normalize | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import sqlite3 as lite | |
import time | |
from dateutil.parser import parse | |
import collections |
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 numpy as np | |
import matplotlib.pyplot as plt | |
import statsmodels.api as sm | |
import statsmodels.formula.api as smf | |
df = pd.read_csv('LoanStats3b.csv', header=1, low_memory=False) | |
df['issue_d_format'] = pd.to_datetime(df['issue_d']) | |
dfts = df.set_index('issue_d_format') |
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 statsmodels.formula.api as smf | |
import numpy as np | |
df = pd.read_csv('https://github.com/Thinkful-Ed/curric-data-001-data-sets/raw/master/loans/loansData.csv') | |
df['annual_inc'] = df['Monthly.Income'].map(lambda x: x * 12) | |
df['int_rate'] = df['Interest.Rate'].map(lambda x: round(float(x.rstrip('%')) / 100, 4)) | |
df['home_ownership'] = df['Home.Ownership'] |
NewerOlder