If you want to practice Pandas and NumPy for a data analyst interview, or just get faster at everyday data wrangling, the friction is usually the setup — installing Python, managing environments, getting the right package versions. Here's a way to skip all of that.
I put together a free, browser-based Python compiler (Skillancy Python Compiler) that runs real CPython 3.13.2 (via Pyodide/WebAssembly) directly in your browser tab, with NumPy and Pandas available. No signup, no install, and nothing you write is sent to a server.
Here are eight examples covering the patterns that come up most — from basics to Pandas groupby, merges, missing values, and rolling averages.
1. Basics: variables, f-strings and loops
name = "Skillancy"
scores = [72, 85, 90, 64]
average = sum(scores) / len(scores)
print(f"{name} average score: {average:.1f}")
for s in scores:
print(s, "pass" if s >= 70 else "fail")
2. List comprehension and counting
collections.Counter is one of the most underused tools in the standard library for quick frequency counts.
from collections import Counter
words = "data analytics needs clean data and clear questions".split()
lengths = [len(w) for w in words]
print(lengths)
print(Counter(words).most_common(2))
3. Functions: dedupe while keeping order
A common interview question — remove duplicates from a list without changing the order of first appearance.
def dedupe(items):
seen = set()
result = []
for item in items:
if item not in seen:
seen.add(item)
result.append(item)
return result
print(dedupe([3, 1, 3, 2, 1, 4]))
4. Pandas groupby
The bread and butter of any analytics job — summarizing a metric by category.
import pandas as pd
df = pd.DataFrame({
"city": ["Pune", "Delhi", "Pune", "Chennai", "Delhi"],
"sales": [120, 90, 150, 60, 110],
})
print(df.groupby("city")["sales"].agg(["sum", "mean"]))
5. Pandas merge
The Pandas equivalent of a SQL LEFT JOIN — combining two tables on a shared key.
import pandas as pd
orders = pd.DataFrame({"order_id": [1, 2, 3], "customer_id": [10, 11, 10], "amount": [250, 400, 150]})
customers = pd.DataFrame({"customer_id": [10, 11, 12], "name": ["Asha", "Ravi", "Meera"]})
merged = orders.merge(customers, on="customer_id", how="left")
print(merged)
6. Missing values: find and fill
Real datasets are messy. This is the standard pattern for spotting and handling gaps.
import numpy as np
import pandas as pd
df = pd.DataFrame({
"age": [25, np.nan, 31, np.nan, 40],
"city": ["Pune", "Delhi", None, "Delhi", "Pune"],
})
print(df.isna().sum())
df["age"] = df["age"].fillna(df["age"].median())
df["city"] = df["city"].fillna("Unknown")
print(df)
7. NumPy statistics: z-scores
Vectorized math without writing a single loop.
import numpy as np
data = np.array([12, 15, 11, 18, 20, 14])
print("mean:", data.mean(), "std:", round(data.std(), 2))
print("above mean:", data[data > data.mean()])
z = (data - data.mean()) / data.std()
print(np.round(z, 2))
8. Dates and rolling averages
Smoothing out noisy daily data — a common step before charting a trend.
import pandas as pd
days = pd.date_range("2026-01-01", periods=10, freq="D")
df = pd.DataFrame({
"date": days,
"visits": [120, 135, 128, 150, 160, 155, 170, 165, 180, 175],
})
df["rolling_3d"] = df["visits"].rolling(3).mean().round(1)
print(df)
That's the core toolkit for practicing Pandas and NumPy without any local setup. If you want to try these yourself or experiment with variations, the Python compiler is free — it runs CPython 3.13.2 in your browser via WebAssembly, with NumPy and Pandas ready to import.
If there's a Pandas or NumPy pattern you always forget the syntax for, drop it in the comments — happy to add it to the next round of examples.
Top comments (1)