Monte Carlo Business Case Analysis with pandas

Arthur Street

Monte Carlo
Business Case Analysis
with pandas

Attempt 2 things: - introduce you to Monte Carlo business case analysis. - plant the idea it is not crazy to use pandas for this purpose. . What is business case analysis?

Goal: Turn this...

...into this...

...and this...

without using a spreadsheet


More at the European Spreadsheet Risks Interest Group

Why pandas?

Why pandas?

Why pandas?

Overview

  1. Read data
  2. Simulate
  3. Calculate
  4. Report

Overview

  1. Read data
  2. Simulate
  3. Calculate
  4. Report
			costs = pd.read_csv('costs.csv')
			or
			costs = pd.read_excel('cashflows.xlsx')
		

Overview

  1. Read data
  2. Simulate
  3. Calculate
  4. Report
			data.groupby(keys).apply(sim, N)
			def sim(g, size):
			   return DataFrame(normal(g.mean,g.sd,
			                           size=size))
		

Overview

  1. Read data
  2. Simulate
  3. Calculate
  4. Report
			
			sim['revenue'] = sim['volume'] * sim['price']
		

Overview

  1. Read data
  2. Simulate
  3. Calculate
  4. Report
			cashflows.hist()
			cashflows.to_excel('report.xlsx')
		

Demonstration

Good things

Bad things

Next steps...

https://bitbucket.org/artstr/montepylib

Questions?

https://bitbucket.org/artstr/montepylib