Python Roadmap for Petroleum Engineering
(Beginner → Research Level, 3–6 months plan)
📍 Phase 1: Foundations (2 weeks)
🔹 Goal: Be able to write and run simple Python programs.
1. Setup
o Install Anaconda (comes with Python, Jupyter Notebook,
Pandas, Numpy, Matplotlib).
o Open Jupyter Notebook (best for learning + keeping notes like
a "Python diary").
2. Basics to Learn
o Printing and comments: print("Hello"), # comment.
o Variables: oil_rate = 350
o Data types: numbers, strings, lists ([ ]), dictionaries ({ }).
o Simple math: +, -, *, /, ** (power).
o Functions:
o def density(api):
o return (141.5/(api+131.5))*62.4
o print(density(40))
📖 Practice Idea:
Write a function to convert API → density.
Write a function to calculate hydrostatic gradient.
📍 Phase 2: Excel Handling (2–3 weeks)
🔹 Goal: Replace Excel formulas with Python.
1. Pandas basics
o Load Excel:
o import pandas as pd
o df = pd.read_excel("[Link]")
o print([Link]())
o Access columns: df["Q"], df["API"]
o Apply formulas with [Link]().
2. Numpy basics (for scientific math)
o Arrays: [Link]([1,2,3])
o Mean, sum, sqrt, log.
📖 Practice Idea:
Make a table in Excel with columns (Q, API, Depth, Tubing).
Load into Python, calculate BHP using hydrostatic gradient.
Save results back to Excel.
📍 Phase 3: Petroleum Engineering Correlations (4–6 weeks)
🔹 Goal: Implement correlations you normally do in Excel.
1. Fluid properties
o Oil density from API.
o Gas density from real gas law.
o Water density and gradients.
2. Well performance
o Hydrostatic pressure = ρgh.
o Poettmann-Carpenter correlation (for multiphase flow).
o Vogel IPR equation.
3. Automation
o Write a Python function for each correlation.
o Run them over 100+ cases automatically (Excel struggles
here).
📖 Practice Idea:
Implement Poettmann-Carpenter in Python and plot pressure vs
depth.
Compare results with your Excel file.
📍 Phase 4: Visualization & Reporting (3–4 weeks)
🔹 Goal: Make professional plots for reports/thesis.
1. Matplotlib basics
2. import [Link] as plt
3. [Link](depth, pressure)
4. [Link]("Depth (ft)")
5. [Link]("Pressure (psi)")
6. [Link]()
7. Plotly (optional, for interactive plots)
8. import [Link] as px
9. fig = [Link](df, x="Depth", y="BHP", title="BHP Profile")
10. [Link]()
11. Export for LaTeX / Reports
o Save plots as PNG, PDF.
o Insert in your thesis.
📖 Practice Idea:
Make a plot of BHP vs. depth for different flow rates.
Plot Vogel curve (flow rate vs BHP).
📍 Phase 5: Advanced Research Tools (2–3 months, optional but
powerful)
🔹 Goal: Use Python for research & MS/PhD projects.
1. Numerical Simulation
o Solve equations with [Link].
o Example: calculate wellbore pressure drop using iteration.
2. Machine Learning (ML) for Petroleum
o Use scikit-learn for regression (predict BHP, EOR recovery).
o Train ML models on lab or field data.
3. Automation of Workflows
o Automatically read field data (CSV/Excel).
o Run your model.
o Export results + plots.
📖 Research Project Idea:
"Optimization of Gas Lift Performance using ANN" → you can build
your dataset in Excel, then use Python ML libraries to model &
optimize.
⏳ Timeline Summary
Month 1: Basics + Excel replacement.
Month 2: Petroleum correlations + automation.
Month 3: Visualization + reports.
Month 4–6: Advanced research (ML, simulations).
🎯 End Result
If you follow this roadmap:
✅ You’ll replace Excel for calculations.
✅ You’ll generate research-quality graphs for your MS thesis.
✅ You’ll have Python scripts that professors and industry both respect.
✅ You’ll be ahead of 90% of petroleum engineers who only know Excel.
Would you like me to also create a sample "Learning Notebook" in
Jupyter (with exercises + solutions) so you can use it like a practice
workbook alongside this roadmap?