Python Functions & Libraries Reference Guide

Reference guide to Python libraries and functions for numerical computations, data analysis, simulations, and automation

Python Libraries

Library Description Key Functions
NumPy Efficient numerical computation with arrays, matrices, and linear algebra. array(), linspace(), arange(), mean(), sum(), dot(), reshape(), random()
pandas Data manipulation and analysis; handling CSV, Excel, and tabular data. read_csv(), DataFrame(), head(), describe(), merge(), groupby(), pivot_table()
scipy Scientific computing for optimization, integration, interpolation, and signal processing. integrate.quad(), optimize.minimize(), interpolate.interp1d(), signal.convolve()
matplotlib 2D plotting and chart visualization library. plot(), scatter(), bar(), hist(), subplot(), figure(), xlabel(), ylabel(), title()
seaborn Statistical data visualization built on matplotlib. heatmap(), pairplot(), boxplot(), countplot(), distplot(), regplot()
SymPy Symbolic mathematics for algebra, calculus, and equation solving. symbols(), diff(), integrate(), solve(), simplify(), Eq()
SimPy Discrete-event simulation for modeling processes and systems. Environment(), Process(), Resource(), run(), timeout()
control Control systems analysis and design, transfer functions, state-space, and plotting. tf(), ss(), step_response(), impulse_response(), bode(), nyquist(), rlocus()
openpyxl Excel automation: read, write, and manipulate spreadsheets. load_workbook(), Workbook(), active, cell(), save(), append()
os Automate file system operations and environment tasks. listdir(), mkdir(), remove(), path.exists(), getcwd(), chdir()
shutil High-level file operations for copying, moving, and archiving files. copy(), move(), rmtree(), make_archive(), unpack_archive()

Core Math & Algebra Functions

Function Description Required Library Example
abs()Absolute value of numbers or arrays.Built-in / NumPy (np)abs(-5)
np.abs([-1,-2])
sqrt()Square root of a number or array elements.math / NumPy (np)math.sqrt(25)
np.sqrt([4,9,16])
pow()Exponentiation of numbers.Built-inpow(2, 3)
exp()Exponential function e^x.NumPy (np)np.exp(2)
log()Natural or base-n logarithm.math / NumPy (np)math.log(10)
np.log10(1000)
solve()Solve algebraic equations.SymPyx = symbols('x')
solve(x**2 - 4, x)

Linear Algebra & Matrix Functions

Function Description Required Library Example
array()Create a NumPy array.NumPy (np)np.array([1,2,3])
dot()Dot product of two vectors/matrices.NumPy (np)np.dot([1,2],[3,4])
matmul()Matrix multiplication.NumPy (np)np.matmul(A,B)
inv()Matrix inverse.NumPy.linalg (la)la.inv(A)
eig()Eigenvalues and eigenvectors.NumPy.linalg (la)la.eig(A)
det()Determinant of a matrix.NumPy.linalg (la)la.det(A)

Statistics & Probability Functions

Function Description Required Library Example
mean()Arithmetic mean of data.NumPy (np)np.mean([1,2,3,4])
std()Standard deviation.NumPy (np)np.std([1,2,3,4])
var()Variance of array elements.NumPy (np)np.var([1,2,3,4])
random()Generate random values.NumPy (np)np.random.rand(3,2)
normal()Generate values from a normal distribution.NumPy (np)np.random.normal(0,1,1000)

Visualization & Plotting Functions

Function Description Required Library Example
plot() Line plot of x,y data. Matplotlib (plt) plt.plot(x, y)
plt.show()
scatter() Scatter plot of data points. Matplotlib (plt) plt.scatter(x, y)
plt.show()
bar() Bar chart of categories vs. values. Matplotlib (plt) plt.bar(categories, values)
plt.show()
hist() Histogram of numeric data distribution. Matplotlib (plt) plt.hist(data, bins=10)
plt.show()
heatmap() Heatmap visualization of matrix/data correlations. Seaborn (sns) / Matplotlib (plt) sns.heatmap(df.corr(), annot=True)
plt.show()

Simulation & Control System Functions

Function Description Required Library Example
integrate.quad()Numerical integration.SciPyintegrate.quad(lambda x: x**2, 0, 1)
odeint()Solve ODE systems numerically.SciPyodeint(model,y0,t)
step_response()Step response of control system.Controlsys = control.tf([1],[1,1])
control.step_response(sys)
impulse_response()Impulse response of control system.Controlcontrol.impulse_response(sys)
rlocus()Root locus plot.Controlcontrol.rlocus(sys)

About Python Functions and Libraries Reference Guide

This comprehensive Python reference provides detailed insights into the most essential Python libraries, functions, and tools for numerical computation, data analysis, simulation, and automation. It is designed for engineers, researchers, and students who want to efficiently solve technical problems, model systems, and process large datasets using Python.


Applications


By understanding these Python libraries and functions, engineers and scientists can accelerate computational workflows, automate processes, and improve the accuracy and reliability of analysis and simulations. This reference serves as a quick reference for professionals and students looking for common Python functions and features for technical problem-solving, simulation, and data analysis.