Concepts
This section of the wiki is dedicated to providing guidance on and examples of Python code. On pages which discuss examples of code, guidance is given on best practices and what to avoid when doing similar work.
Notice: If you use any of this code in your own assignments, it will be extremely easy to trace, and you will likely fail the assignment. This code is meant as a way to learn by example, not as something from which you can change a couple minor things and then submit. Please do your own work.
ILP Formulation Examples
Examples here are given in both GurobiPy and OR-Tools.
Using Modules
MatPlotLib Examples
- Simple Scatter Plot
- Simple Histogram
- Simple Pie Chart
- Simple Plotting with
plt
(plotting normal CDF)
NumPy/SciPy Examples
pandas Examples
- Reading a CSV file into a DataFrame
- Using a pandas DataFrame in an ILP Formulation (Juice Problem)
- Reading an Excel file into a DataFrame
- Filtering DataFrames
- Plotting Data from DataFrames
- SQL-like Commands with DataFrames