Real Estate Investing in Philadelphia

Data Preprocessing

melted = pd.melt(df, id_vars=['RegionName'], var_name='time')
melted['time'] = pd.to_datetime(melted['time'], infer_datetime_format=True)
melted = melted.dropna(subset=['value'])


ARIMA Modeling

def find_p_and_q(ts, verbose=True):    # Finds the optimal p, d, and q for an arima model
# To start, we create a set of possible pdq combinations
p = range(5)
d = range(3)
q = range(5)
pdq = list(itertools.product(p, d, q))

# Next we run each combination through an arima model and record the AIC
AICs = []
for comb in pdq:
model = ARIMA(ts, order=comb, enforce_stationarity=True, enforce_invertibility=True)
output =
AICs.append([comb, output.aic])
# need to have a fail safe in case the arima won't converge
AIC_df = pd.DataFrame(AICs, columns=['pdq', 'AIC'])
if verbose:
# prints the pdq combination with lowest AIC
# returns the pdq combination with lowest AIC
return AIC_df.loc[AIC_df.AIC.idxmin()][0]

Zip code 19142:

Zip code 19131:

Zip code 19124:

Zip code 19119:

Zip code 19136:





Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Building a Rock Paper Scissors AI

A Year of Ed Sheeran: Analyzing Spotify Global Trends

Newton vs Neural Networks: How AI is Corroding the Fundamental Values of Science.

I love the depth and breadth of this piece.

Python Pandas: A Powerful Tool for Data Analytics

Introduction to Statistics and Its types

Why Data Extraction Services are Better Than Tools for Enterprises

Data Life Cycle Analysis

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chris Grannan

Chris Grannan

More from Medium

How I Tried To Build A DTC Brand & Lost Over $300,000

Significant paper review

Road to Web3 — Wallet Integration

What is an alternative investment?

Alternative investments commercial aircraft