DEV Community

Esther Njihia
Esther Njihia

Posted on

Data engineering 102: Introduction to python for data engineering.

Overview

The most interesting thing about python language is sort of all rounded. Due to its readability which is easy and the fact that it has very many applications including data engineering. In this post, we will discuss the most important concepts in the python language.

Python Syntax

Python, builds the code structure using whitespace and indentation.

Comments

The comments are just as crucial as the code itself, because they explain why a piece of code was produced
The comments are ignored by the Python interpreter when it runs the code.
A single line comment in Python starts with the hash symbol (#), which is followed by the comment.

Identifiers

Python uses identifiers, or names, to designate variables, functions, modules, classes, and other types of objects.
An identifier's name must begin with a letter or an underscore. After that, only underscores or alphanumeric characters are allowed.

Keywords

Keywords are words that have special meaning in python. Python has a special module keyword that outlines all the keywords that are used in the Python Language.

Control statements

If statements.

If statements are conditional statements. Below is the summary of the different if statements:
When you want to run a code block based on a condition, use the if statement.
If you want to execute a different code block if the condition is not True, use the if...else statement.
When you wish to check multiple conditions and execute the associated code block after the condition that evaluates to True, use the if...elif...else statement.

for loop

A code block can be performed a predetermined number of times by using the for loop statement.
To alter the loop, use the range(start, stop, step).

while loop.

If a condition is True, use the Python while loop statement to run a code block.

Functions

A named, reusable chunk of code called a function in Python executes a command or returns a value.
Create a new function by using the def keyword. The function definition and body make up a function.
A function may have 0 parameters or more. You must pass a function the same amount of arguments if it has one or more parameters.
A function can do a task or give back a value. If you want to return a value from a function, use the return statement.

Lists

An orderly group of elements is referred to as a list.
If you want to retrieve a list element by its index, use the square bracket notation []. The index of the first element is zero.
To reach a list element from the list's end, use a negative index. The final component has an index of -1.
To change an entry from a list, use list[index] = new value.
To add a new element to the end of a list, use the append() method.
To insert a new element at a certain location in a list, use insert().
To remove an entry from a list and return it, use the pop() function.
To eliminate an element from a list, use remove().
Tuples are immutable lists.
Use tuples when you want to define a list that cannot change.

Dictionary

A Python dictionary is a group of key-value pairs, each of which has a corresponding value.
In order to access a value by its key, use square brackets or the get() method.
To remove a key-value pair by the key from a dictionary, use the del statement.
To iterate through the keys, values, and key-value pairs in a dictionary, use a for loop.

This post includes a summarization of some most important concepts as a beginner in Python.

Top comments (2)

Collapse
 
mohammad_allaithi_2f571fe profile image
Mohammad Allaithi

Hello data guys I want your help I have a presentation and I want the best topic related to data engineering

Collapse
 
esther_njihia profile image
Esther Njihia

Data exploration using python
RDBMS or Nosql
Data collection: web scraping, API