Language
Python
- First appeared
- 1991
- Paradigm
- Multi-paradigm (imperative, object-oriented, functional)
- Toolchain
- CPython 3.15.2
- Container image
python:3.15.2-slim-trixie
Python is the most common language for data science today, but almost
always with NumPy, pandas, and scikit-learn doing the work. None of those
ship with Python, and pip is removed from this image, so here it has only
its standard library. That library is generous: csv reads the data by
header name, math has square roots, logs, and math.dist, and
statistics has mean, median, variance, stdev, and even
linear_regression and correlation. The from-scratch versions skip
statistics so the arithmetic stays visible, which makes Python the
baseline the other languages are compared against.
Quirks
/always gives a float, so7 / 2is3.5;//is floor division.statistics.variancedivides by n − 1, like the formulas on this site.sortedis stable, so ties keep their original order.
Concepts in Python
- Cross-validation
- Decision tree
- Descriptive statistics
- k-means clustering
- k-nearest neighbors
- Linear regression
- Logistic regression
- Naive Bayes
- Principal component analysis
- Descriptive statistics (built-in)
- Linear regression (built-in)
Run the examples locally
You need Docker and Python 3. The harness builds the pinned container and runs every Python example:
git clone https://github.com/qnixon/dswithx.git
cd dswithx
python3 harness/run_tests.py --language python