Category Python Modules

Modules is one of the best feature of Python. Except some core modules, you can install what you need and keep your Python setup smooth.

Pandas Read Excel: Load a Workbook

Pandas Read Excel: Load a Workbook

A Python analysis can start with the values stored in an Excel worksheet. pandas.read_excel() reads worksheet values into a DataFrame, a labeled table with rows and columns. I’ll show how to read one sheet or collect several, and how to…

Import Math Module in Python

Import Math Module in Python

For a circle-area calculation in Python, you can use pi from the math module. Python’s math module provides numeric constants and functions, including math.pi for circle calculations. This article shows how to import pi by name and choose a math…

Python sys Module: Arguments, Paths, and Streams

Python sys Module: Arguments, Paths, and Streams

Command-line arguments let a Python script receive values supplied when it starts. The sys module exposes those argument strings alongside information maintained by the running interpreter. I’ll show how to read sys.argv and check whether an optional argument is present…

np.outer(): Outer Product in NumPy

np.outer(): Outer Product in NumPy

To calculate every pairwise product between two inputs, use NumPy’s np.outer function. It multiplies each value in one input by each value in the other and returns a two-dimensional array. This article explains how the input shapes determine the result…

np.linalg.solve() Linear Systems

np.linalg.solve() Linear Systems

To solve a set of linear equations, find the values of its unknowns. NumPy’s np.linalg.solve() does that when the coefficient matrix has the same number of rows and columns and its equations are independent. I’ll show how to put the…

Statsmodels Library Structure and Imports

Statsmodels Library Structure and Imports

Finding an import in Statsmodels starts with the model or helper you want to use. The package groups models, tests and tools into subpackages by subject, while an API module collects selected objects for convenient use. I’ll show how to…

Python Logarithm Base 2 Using NumPy log2()

Python Logarithm Base 2 Using NumPy log2()

For a set of numbers, you can use a base-2 logarithm to express each value as an exponent on two. NumPy’s log2 function calculates that result element by element for array-like input. This article shows how to apply np.log2 to…