The whatif package helps you build business analysis oriented models in Python that you might normally build in Excel. Specifically, whatif includes functions that are similar to Excel's Data Tables and Goal Seek for doing sensitivity analysis and "backsolving" (e.g. finding a breakeven point). It also includes functions for facilitating Monte-Carlo simulation using these models.
Related blog posts
- Part 1: Models and Data Tables
- Part 2: Goal Seek
- Part 3: Monte-carlo simulation
- Part 4: Project structure and packaging
This package is also developed as part of one of the courses I teach. You can find the course web pages at:
- Submodule 1: What if analysis with Python
- Submodule 2: Creating the whatif package
- Submodule 3: Using Python to wrangle Excel files
The whatif package is new and quite small. It contains:
- a base
Model
class that can be subclassed to create new models - Functions for doing data tables (
data_table
) and goal seek (goal_seek
) on a models - Functions for doing Monte-Carlo simulation with a model (
simulate
)
Clone the whatif project from GitHub:
.. code::
git clone https://github.com/misken/whatif.git
and then you can install it locally by running the following from the project directory.
.. code::
cd whatif
pip install .
See the materials in the blog posts and course webs listed above.
The project is licensed under the MIT license.