bhylu.com

Advertisements

Data Science Installation

Prepare a separate Python environment instead of changing the website runtime.

How it works

The local review uses Python 3.12.14, NumPy 2.5.4, Pandas 3.0.6 and SciPy 1.18.0. Plotting additionally uses Matplotlib 3.11.2. These are reviewed pins, not a claim that every library is the newest version. Browser examples use the existing isolated NumPy, Pandas or SciPy editor, whose package versions differ. A matching import name does not guarantee that every API or result is identical across releases.

Run the code

This is a local example: it checks the combined local package environment, rather than one browser editor.

Local review: Python 3.12.14, NumPy 2.5.4, Pandas 3.0.6 and SciPy 1.18.0. Browser review: Pyodide 0.27.7, Python 3.12.7, NumPy 2.0.2, Pandas 2.2.3 and SciPy 1.14.1 in their respective editors. Save the download as installation.py and run python installation.py in your separate environment. Apache and MySQL are not needed. Environment setup.

Download the complete source

In a separate learning folder run python -m venv .venv. In Windows Command Prompt activate it with .venv\Scripts\activate, then run python -m pip install numpy==2.5.4 pandas==3.0.6 scipy==1.18.0. Optional plotting: python -m pip install matplotlib==3.11.2. The example below checks imports. Do not change the website or a global Python installation.

Example

installation.py

import numpy as np
import pandas as pd
import scipy
assert np.asarray([1., 2.]).shape == (2,)
assert pd.DataFrame({"litres": [1, 2]}).shape == (2, 1)
print("NumPy, Pandas and SciPy imports ready")

Expected result

NumPy, Pandas and SciPy imports ready

Create a separate folder, run python -m venv .venv, activate it and install the pinned packages listed in the setup notes. Save this source as installation.py and run it there. The imports confirm package availability and two simple shapes. Apache, PHP and MySQL are not part of this scientific Python environment.

Technical references: NumPy, Pandas and SciPy. For evaluation design see the scikit-learn guide to leakage; these examples do not require scikit-learn.