CoderzColumn : Python Tutorials (Page: 4)

Python Tutorials


Python is one of the most widely used programming languages today. This section is a large archive of tutorials, based on Python programming language. We cover the basic and advanced technical aspects through coding examples and snippets.

  • Parallel Computing
  • Concurrent Programming
  • Speed Up Python Code
  • Working with Emails
  • Profiling
  • Jupyter Notebook Helpers
  • Web Scraping
  • File & Directory Access
  • Work With Archives
  • Generic OS Services
  • Python Runtime Services
  • Text Processing Services
  • File Formats
  • Networking & Interprocess Communication
  • Image Processing

For an in-depth understanding of the above concepts, check out the sections below.

Recent Python Tutorials


Tags dask-array, parallel-computing, distributed-compu…
Dask Array: Guide to Work with Large Arrays in Parallel [Python]
Python

Dask Array: Guide to Work with Large Arrays in Parallel [Python]

Dask Array: Guide to Work with Large Arrays in Parallel & Distributed Environment

Sunny Solanki  Sunny Solanki
Tags numba, pandas-dataframe
How to Speed up Code involving Pandas DataFrame using Numba?
Python

How to Speed up Code involving Pandas DataFrame using Numba?

How to Speed up Operations on Pandas DataFrame using Numba?

Sunny Solanki  Sunny Solanki
Tags awkward-array, json-like-data-structures, tree-li…
Awkward Array: Guide to Work with JSON-like Nested, Variable-sized Datasets using Numpy-like Idioms
Python

Awkward Array: Guide to Work with JSON-like Nested, Variable-sized Datasets using Numpy-like Idioms

Awkward Array: Guide to Work with JSON-like Nested, Variable-sized Data Structures using Numpy-like Idioms

Sunny Solanki  Sunny Solanki
Tags xarray, DataArray
xarray.DataArray: Simple Guide to Labeled N-Dimensional Array
Python

xarray.DataArray: Simple Guide to Labeled N-Dimensional Array

xarray (DataArray) : Simple Guide to Labeled N-Dimensional Array

Sunny Solanki  Sunny Solanki
Tags numba, vectorize-decorator, ufunc
Numba @vectorize Decorator: Convert Scaler Function to Universal Function (ufunc)
Python

Numba @vectorize Decorator: Convert Scaler Function to Universal Function (ufunc)

Numba @vectorize Decorator: Convert Scaler Function to Universal Function (ufunc)

Sunny Solanki  Sunny Solanki
Tags dask, dataframes
Dask DataFrames: Simple Guide to Work with Large Tabular Datasets [Python]
Python

Dask DataFrames: Simple Guide to Work with Large Tabular Datasets [Python]

Dask DataFrames: Simple Guide to Work with Large Tabular Datasets

Sunny Solanki  Sunny Solanki
Tags jax, xla, automatic-gradients
JAX - (Numpy + Automatic Gradients) on Accelerators (GPUs / TPUs)
Python

JAX - (Numpy + Automatic Gradients) on Accelerators (GPUs / TPUs)

JAX - (Numpy + Automatic Gradients) on Accelerators (GPUs/TPUs)

Sunny Solanki  Sunny Solanki
Tags draw-shapes, scikit-image
How to Draw Shapes on Images using Scikit-Image [Python]?
Python

How to Draw Shapes on Images using Scikit-Image [Python]?

How to Draw Shapes on Images using Scikit-Image [Python]?

Sunny Solanki  Sunny Solanki
Tags pandas, styling
Simple Guide to Style Pandas DataFrames
Python

Simple Guide to Style Pandas DataFrames

The tutorial covers a detailed guide to style display of pandas dataframe in Jupyter notebooks. This involves things like styling header/index, individual row/column/cell, highlight Nan/Null, min/max per row/column, dataframe heatmap, dataframe bar chart, etc. The styling operation can be changing font style/size/color/background, adding padding/margin, and many other possible CSS operations.

Sunny Solanki  Sunny Solanki
Tags pandas, dataframe-data-formatting
Simple Guide to Set Pandas Options to Better Display DataFrames
Python

Simple Guide to Set Pandas Options to Better Display DataFrames

Simple Guide to Set Pandas Options to Better Display DataFrames

Sunny Solanki  Sunny Solanki
Parallel Computing using Python

Parallel Computing using Python


Parallel Computing is a type of computation where tasks are assigned to individual processes for completion. These processes can be running on a single computer or cluster of computers. Parallel Computing makes multi-tasking super fast.

Python provides different libraries (joblib, dask, ipyparallel, etc) for performing parallel computing.

Concurrent Programming in Python

Concurrent Programming in Python


Concurrent computing is a type of computing where multiple tasks are executed concurrently. Concurrent programming is a type of programming where we divide a big task into small tasks and execute these tasks in parallel. These tasks can be executed in parallel using threads or processes.

Python provides various libraries (threading, multiprocessing, concurrent.futures, asyncio, etc) to create concurrent code.

Speed Up Python Code

Speed Up Python Code


Python is an interpreter-based language and hence is slow compared to compiler-based languages (C / C++ / Java, etc). But we can make it super fast (Almost as fast as C++).

Python has a library named 'Numba' that can help us with it. Numba is a JIT Compiler (Just-In-Time) of Python. It converts Python code to faster machine-level code using 'LLVM' compiler.

To convert python code to low-level machine code, it provides us with various decorators (@jit, @njit, @vectorize, @guvectorize, @stencil, etc.). We can decorate our Python functions using these decorators to speed up our Python functions.

Numba even let us parallelize compiled code on multiple CPUs / GPUs for even faster completion.

Working with Emails in Python

Working with Emails in Python


Python provides various libraries to work with emails. Libraries to send emails, manage mailboxes and represent emails are different based on HTTP protocol.

To send emails, Python provides a library named 'smtplib' (based on SMTP protocol).

To manage mailboxes (read emails, flag emails, move emails, create folder / directory, delete email / directory, etc), Python offers a library named 'imaplib' (based on IMAP protocol).

To represent emails, Python has a library named 'email'. To determine MIME Type of attachment file, Python offers a library named 'mimetypes'.

Profile Python Code / Script / Program

Profile Python Code / Script / Program


Profiling is the process of recording time taken by Python program / code / script / process. It measures the time complexity of a program.

Apart from time, we can also record memory usage (space complexity) by our code / program. The process of recording memory usage is referred to as 'memory profiling'. Profiling can help us make better decisions regarding resource allocation as well it presents many opportunities to optimize existing code for maximum resource utilization.

Python has many libraries (cProfile, profile, line_profiler, memory_profiler, tracemalloc, pprofile, scalene, yappi, guppy, py-spy, pyinstrument, etc.) to profile time and memory usage by our Python code.