1st Edition · 2026

Python for
Oil & Gas

Data Science, Engineering Analytics, and AIin the Petroleum Industry.

24 hands-on chapters taking you from Python fundamentals through PVT correlations, decline curve analysis, and reservoir simulation — all the way to deep learning and cloud deployment. Built on real Niger Delta field data.

By Johnpaul Okeke · SPE Member

Python for Oil & Gas — book cover by Johnpaul Okeke

What You'll Learn

From Setup to Production

Each chapter builds on the last — starting with Python basics and ending with production-grade ML models deployed on the cloud. Every concept is grounded in real petroleum engineering problems.

terminal

Python Fundamentals

From zero to fluent — variables, functions, OOP, and the scientific stack tailored for petroleum workflows.

database

Petroleum Data Engineering

Load, clean, and transform LAS files, production CSVs, and well test data using Pandas and domain libraries.

calculate

Well Log Analysis

Compute porosity, water saturation, and net pay with Archie's equation and triple-combo log interpretation.

insights

Production Forecasting

Apply Arps decline curves, material balance, and nodal analysis to predict well and reservoir performance.

dashboard

Machine Learning

Build supervised and unsupervised models for facies classification, production prediction, and anomaly detection.

biotech

Dashboards & Deployment

Ship production-ready Streamlit and Dash apps, deploy to the cloud, and integrate with real-time SCADA data.

Interactive Playground

Write Real Engineering Code

Every chapter includes runnable Python code. Edit it, run it, see the output — right in your browser. No installation required.

hydrostatic_pressure.py
def calculate_hydrostatic_pressure(tvd_ft, mud_weight_ppg):
"""Compute hydrostatic pressure in psi."""
pressure_psi = 0.052 * mud_weight_ppg * tvd_ft
return pressure_psi
# OML 58 — Well OD-003, 10,000 ft TVD, 12.5 ppg mud
p = calculate_hydrostatic_pressure(10_000, 12.5)
print(f"Hydrostatic Pressure: {p:,.0f} psi")

>>> Hydrostatic Pressure: 6,500 psi

Who This Book Is For

Built for Engineers Who Build Things

school

Engineering Students

Supplement your petroleum engineering coursework with practical Python skills that employers actually look for.

engineering

Working Engineers

Automate repetitive calculations, build custom analysis tools, and make data-driven decisions faster.

code

Python Developers

Apply your existing programming skills to the energy sector — one of the world's largest and most data-rich industries.

Johnpaul Okeke — Author of Python for Oil & Gas

About the Author

Johnpaul Okeke

Petroleum engineer, SPE member, and the lead developer behind PhiDrillSim — a Python-based drilling simulation engine that models torque-and-drag, hydraulics, and rate-of-penetration in real time. Former VP of the NGA UNILAG Student Chapter, where he organized technical workshops bridging petroleum engineering and modern software practices.

His work focuses on what he calls “Industrial Intelligence” — applying Python, data science, and AI to solve real problems in the Nigerian oil and gas sector and beyond. This book distills that experience into 24 practical chapters.

verifiedSPE MemberterminalPhiDrillSim LeadschoolUNILAG

Get the Book

Start Building Today

Digital Edition

$29

One-time purchase. Lifetime updates.

  • check_circleAll 24 chapters (PDF + EPUB)
  • check_circleInteractive code playground
  • check_circleAll exercises with solutions
  • check_circle5 real industry datasets
  • check_circleProgress tracking dashboard
Get Digital Edition
Recommended

Print + Digital

$49

Everything digital, plus the hardcover.

  • check_circleEverything in Digital Edition
  • check_circlePremium hardcover (full color)
  • check_circleQuick reference card included
  • check_circleFree global shipping
  • check_circlePriority support from the author
Order the Bundle

Join 2,500+ Petroleum Engineers

Weekly Python tips for the energy sector, early access to new chapters, and case studies from real Niger Delta field operations.