***************************************** What-if analysis with Python ***************************************** Excel is widely used for building and using models of business problems to explore the impact of various model inputs on key outputs. Built in "what if?" tools such as Excel `Data Tables `_ and `Goal Seek `_ are well known to power spreadsheet modelers. How might we do similar modeling and analysis using Python? Through a series of notebooks we will learn: * how to do data tables, goal seek, and Monte-Carlo simulation in Python, * the fundamentals of doing object-oriented programming in Python, * numerous advanced Python data manipulation functions and techniques. Downloads and other resources ============================= This downloads file will be used for the activities below. * `downloads_whatif_oomodeling.zip `_ Activities ================================ We will start with the ``what_if_1_model_datatable.ipynb`` notebook. In it I will introduce the basic model we'll be working with throughout this module. Then we'll build a non-object oriented Python model and develop one approach to doing Excel style data tables. Then we'll learn the basics of object oriented programming and build an OO version of the same model. Finally, we'll develop a ``data_table`` function that uses the OO model. Here are a series of screencasts to help you as you work through this notebook: * `SCREENCAST: The model `_ (10:11) * `SCREENCAST: A non-OO approach to data tables for sensitivity analysis `_ (11:34) * `SCREENCAST: Everything is an object in Python `_ (15:11) * `SCREENCAST: An OO version of the model `_ (11:33) * `SCREENCAST: A software design decision point `_ (10:01) * `SCREENCAST: Generating scenarios for the data table `_ (10:42) * `SCREENCAST: A data table function using the OO model `_ (12:40) .. ~ 82 minutes Now we'll build on this work and develop a Python based goal seek function. We'll use the ``what_if_2_goalseek.ipynb`` notebook. This will involve exploring packages like SciPy for doing root finding and we'll learn a more about what's going on in Excel when you are using Goal Seek. * `SCREENCAST: Root finding with Python `_ (12:33) * `SCREENCAST: Goal seeking with the bookstore model `_ (11:16) .. ~ 24 minutes Now let's see how we might do Monte-Carlo simulation with Python and add a new function to our growing little Python library of Excel style "what-if?" functions. We'll use the ``what_if_3_simulation.ipynb`` notebook. In this part we'll learn about random number generation in Python and see that we can leverage ideas from our ``data_table`` function to create a ``simulate`` function. * `SCREENCAST: Intro to Monte-Carlo simulation model `_ (11:23) * `SCREENCAST: Adding additional uncertainty `_ (7:31) * `SCREENCAST: Building the simulate() function `_ (17:49) .. ~ 37 minutes