My journey to learn Python as a Petroleum Engineer

Photo by Patrick Tomasso on Unsplash

To be called literate in the 2020s there is a good chance you must know how to code. It may seem an exaggeration, but I certainly believe it would be true for engineering roles. I still remember vividly when in 2014 President Obama participated in the ‘Hour of Code’ to encourage students to pick up coding. Those students are entering the job market now and in the coming years and I cannot even imagine how much of impact they would have in the way we live and work. One thing I know is learning how to code is fun, liberating and can save you lots of trouble in the long run while makes you look smarter than you are (certainly true in my case).

Now if you want to start learning Python, you do not have a problem of finding resources, you will have a unique problem of picking the right one. Sometimes it seems to me there are more python tutorials online than the population of earth! (a bit exaggeration but you get my point). My experience in learning new skills over the last few years has taught me one thing, the most time-consuming yet crucial part is mapping the learning path. If I get that part right, things fall in place nicely. I spent a lot of time online and offline discussing with experienced users to map the path for my learning and over the last few years, I have helped many friends and colleagues with where to start Python and how to approach it. In my previous workplace, I advocated for a formal python training to leadership, once I got their approval I researched, picked and tailored the course to suits our Petro-technical engineers and the course was successfully delivered on February 2019.

Photo by Dlanor S on Unsplash

Today I am going to share with you some of the frequent questions I receive and my answers to them. My hope is these questions and answers would ease your way on your journey to learn Python. I share the post on my LinkedIn and my Medium page, and I hope to update it regularly. Please use these as a guideline alongside your research. If you find alternative resources that were helpful please feel free to share them with me or comment them down below for everyone’s benefit. Also please do not hesitate to ask away your questions in the comment or direct message, I would be happy if I can help.

Question 1: Python or R, which one should I learn?

If you are an engineer or want to code for an engineering solution, my answer is Python. Python is the second most popular programming language now while R is 14th and they were in similar rank not long ago. You can read about some of their differences here. As a beginner for at least the first year of learning python, there is a very good chance that any problem you face has an answer ready for you on the internet and that makes the learning process a smoother journey.

Question 2: Python2 or Python3?

Python 2 is dead. So, if you are about to start learning Python, don’t even consider this question as part of your research.

Question 3: Where to start learning Python?

I picked up a few different courses, to begin with. As an engineer, I work with excel sheets, PDF files, office documents every day. Why should I pick up a course that teaches python very well, but the projects are about tic-tac-toe and some other random games? This is why “Automate Boring Stuff with Python” is my top recommendation. Al’s book and delivery are great. More importantly, the course is very practical which allows you to start coding on your small projects very quickly. Those small wins hopefully are going to motivate you and make it easy for you to commit to learning.

Question 4: I finished “Automate Boring Stuff with Python”, now what?

If writing scripts is all you want to know from Python, then “Automate Boring Stuff with Python” should be enough.

If you want to learn python more in-depth or you are thinking on developing applications with more complexity than automating scripts and such, then you may want to have a look at a computer science course with a focus on Python. I highly recommend the 2-part series “Introduction to Computer Science and Programming Using Python” by MITx which is available through the MIT website and Edx. What you get out of the course is how to frame your mind to code like a computer scientist. It is invaluable in making you a more efficient programmer and more comfortable with Python and its libraries’ documentation.

Question 5: Is there any other resources to learn from.

Yes, plenty, I list them here and try to explain in a few short sentences why they have been shortlisted and worth your time:

Think Python:

Great book for an introduction to Python, available for free. What I liked the most was how each chapter has some exercises to help you to judge your understanding.

A whirlwind Tour of Python:

It is a fast-paced introduction to Python and it is tailored to those who are new to Python but have programming background in other languages. If you are profieceint with VBA and you want to pick up Python, maybe this would be a good starting point for you. It is available for free from various sources, such as here and here.

Python for Data Analysis:

If you are ready to learn pandas, then why not learning it from the person who created it. Wes’s book is the go-to for learning pandas, combined that with his videos on YouTube and then learning pandas would be fun. You can purchase the book here.

Medium:

I found Medium website and “towards data science” publishing page particularly useful for finding like-minded people, latest trends and general coding/python tips and tricks that would be handy.

Reddit:

Reddit needs no introduction. I found learnpython and datascience subreddits very useful forums to follow.

Stackoverflow:

Last but not least is stackoverflow. There is a very good chance that any python questions that come to your mind have already been answered here. So, you would learn to rely on this very early in your learning journey.

Question 6: How can I practice.

Try to find easy projects around you. I know this is easier said than done. Finding a good personal project would be one the most challenging part to you in this journey as I had a hard time finding a project that worth doing, yet can deduce to simple challenges so it fits in my skill set and I can approach it.

If you cannot think of any projects early on, don’t panic, it is as natural as losing breath after running a marathon( in my case around the block). The solution is codewars. I found codewars around 2 years ago and that helped me solidify many of my learnings. It gives you small projects to practice your python skills, try to start from basics and gradually increase the level of difficulties.

I have developed a few small and big projects with Python over the last few years, I share two of my favourites below to hopefully gives you some motivation and idea.

The first one is a personal project I did at home using Raspberry Pi and my Solar system. My python code requests the energy output of my solar system every minute, collects it in a database and plots them for me on my command. I can check how many sunny days I had in a month and monitor the quality of my panels over time.

The second one is work-related and it is a project I did at my current role. My application successfully reduced the time required to generate gas and water type curves from over a week for our big fields to minutes, by automating a lot of calculations which were previously run in Excel.

Reservoir Engineer, Python Enthusiast, I love automation and efficiency gains

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store