Data ScienceBeginner12 min readUpdated March 2025
Python Toolkit for Data Science
Python dominates data science thanks to its readable syntax and rich ecosystem. Learn the core libraries — NumPy, pandas, and Matplotlib — and how they fit together in everyday analysis.
The Core Libraries
A small set of libraries covers most day-to-day work:
- NumPy — Fast n-dimensional arrays and vectorized math.
- pandas — Labeled tabular data (DataFrames) for loading, filtering and aggregating.
- Matplotlib / Seaborn — Plotting and statistical visualization.
- SciPy — Scientific computing and statistical tests.
- scikit-learn — Machine learning algorithms and evaluation tools.
- Jupyter — Interactive notebooks that mix code, output and notes.
NumPy: Vectorized Computation
NumPy replaces slow Python loops with operations on whole arrays. This is called vectorization and is often 10–100x faster:
python
import numpy as np
prices = np.array([120.0, 80.5, 99.9, 150.0])
quantities = np.array([2, 5, 1, 3])
revenue = prices * quantities # element-wise, no loop
print(revenue) # [240. 402.5 99.9 450. ]
print(revenue.sum(), revenue.mean())
# Boolean masking
high_value = revenue[revenue > 200]
print(high_value) # [240. 402.5 450. ]pandas: Working with Tables
A DataFrame is a table with labeled columns. The most common operations are selecting, filtering, grouping and merging:
python
import pandas as pd
df = pd.DataFrame({
"region": ["North", "South", "North", "East", "South"],
"product": ["A", "A", "B", "B", "A"],
"sales": [250, 310, 180, 220, 275],
})
# Filter and select
big = df[df["sales"] > 200][["region", "sales"]]
# Group and aggregate
summary = (
df.groupby("region")["sales"]
.agg(["count", "sum", "mean"])
.sort_values("sum", ascending=False)
)
print(summary)Quick Visualization
Plot early and often — a chart reveals problems that summary numbers hide:
python
import matplotlib.pyplot as plt
summary["sum"].plot(kind="bar", color="#34D399")
plt.title("Total Sales by Region")
plt.ylabel("Sales")
plt.tight_layout()
plt.show()Key Takeaways
- NumPy and pandas are the foundation of the Python data stack.
- Prefer vectorized operations over Python loops.
- DataFrames make filtering, grouping and merging concise.
- Visualize data at every step of analysis.
Contact Us
Have a question or feedback? Fill out the form below or reach us directly at support@nvaitraining.com