Lesson 1.01 Pythonic Introduction

View Course Contents
Hide Course Contents

01. Become Pythonic in Oil & Gas Lesson 1.01: Pythonic Introduction

OK, this is the start of the course, Become Pythonic in Oil & Gas Industry. In this course I will walk you through the building blocks of Python code and how to write and run Python code. And to answer specific questions that you may have in your projects, especially those which are dealing with the data. So this course has been designed specifically to work with the data more smoothly using Python.

02. Why Python?

So let's start the course and the first question that you may have in your mind is what is Python? I would say that Python is the fastest growing general-purpose programming language in the world. And it has gained a huge popularity these days. And you will see where that popularity is coming from.
Python solves complex problems in less time with fewer number of lines of code. And then Python also is an interpreted language, which means that as soon as you write your code, Python can execute and give you the results which makes Python very popular for the purpose of typing or quick and fast programing tasks.
To officially summarize why we should use Python I would like to mention 5 points. The first one is that Python is a high-level programing language. It will hide many details of how a program interacts with the computer to give you the results and you don't need to know much of those details and those stuff is being handled in the background by Python itself.
The second point is that Python is the cross-platform language, which means that you write the code one time and you can run it on Windows or Linux system or Mac and they give you exactly the same results. So that is a fantastic feature of Python.
The third point to mention is that Python has a very simple syntax. Actually, it shares many similarities with the plain English language. If somebody reviewed your code, he or she can easily understand what you are trying to achieve with that code, because it is very similar to just the way that we talk and write.
The next point would be Python has huge community support. If you get stuck on your code and have a question or problem, you can go online, search for that specific question or problem and I am sure that you would find tons of solutions that people have provided around the world.
And the last point is that Python has a very large eco-system, which means that if you have a very specific need or you are looking for a very special task to be accomplished, probably somebody has already developed a package that you can find and deploy it in your code and marriage it, customize it or whatever you like and use it in your code.

03. When to Use Python

So when to use Python? That is a question that I will say in four regions you can use Python, the first one is automation. If you have a repetitive task here, for example, working with the number of files, extracting data from then, putting them into Excel, working on those Excel, creating different Excel sheets. Or different tabs in one Excel sheet and on each tab, you are creating multiple columns. And then you want to repeat this task, probably with one Python script, you can accomplish the same tasks very easily and it will give you consistent results and it will reduce the amount of mistakes that you may make during working on each of those individual parts.
Another region is the data analysis. If you are working with the data, which I know is the case for most of the engineers in general, then Python is very powerful in that region too. You can work with the data like data cleaning, extracting features, then sorting the data and then plotting data different variables with respect to each other, you can easily do that in Python.
Another region which is emerging and evolving a lot is the artificial intelligence and machine learning. In the recent years, fascinating packages have been developed for Python, to work with artificial intelligence and machine learning projects. You will be amazed how easy it is to develop a machine learning algorithm in Python. In a few lines, you can have your projects ready and it will generate results easily. It is just amazing.
And the last one is the Web application. You can write your code and share your code with the world through the Web applications. And Python has a few packages, actually easy to use, like Flask or Django which gives you the ability to write Web applications.
OK. I think that's it for why and when for a Python. But before we start to dove into this course, I would like you to keep 3 points in mind. First of all, we are using Python 3 in this course. Python is coming in two versions Python 2 and Python 3, but we are using existing Python 3.7 or 3.6 or above and not Python 2. So if you go online, say for a solution, make sure that it is suitable for Python 3 not Python 2. So this is the first point.
The second point is that new line in Python means a new command. So in most other languages, you use a semicolon to indicate the end of a line or end of a command. But in Python, as soon as you go to the next line or a new line, it will be your new command line.
So the last one, which is very, very important and sometimes confusing especially for the new programmer or for people who are coming from a different programing language background. Avoid a space at the beginning of a new line, has a special meaning in Python. Python interprets that those white spaces at the beginning of a new line differently. And it uses those white spaces to define the scope of the code blocks. Don't worry if you don't understand this at this point, we will cover that in detail. You will see details of that during this course. OK. I think that's it for this lesson. See you in the next lesson.
Back to Top



Ready to enroll?

  • Create a learning schedule
  • Stay on track with regular email updates
  • Share your learning commitment with management and peers
Next lesson will start in 5 seconds ... Cancel

Source code available at:

Become Pythonic in Oil & Gas Course
Chapter 1 - Introduction to Python (15:55)
Chapter 2 - Basic Syntax And Commands (3:04:12)
Chapter 3 - Advanced Functions, Classes and Objects (1:30:27)
Chapter 4 - Modules, Packages and Extra Functions (27:32)