Home / Playground / Python

Online Python compiler with pandas, NumPy and scikit-learn

Write and run Python 3 right here, including data science: pandas, NumPy, scikit-learn, SciPy, statsmodels and Matplotlib. Load a sample dataset in one click, see every variable, and get errors explained in plain English. Your code runs in your browser and is never uploaded.

Program input (for input())
Ctrl/⌘ + Enter: run · Shift + Enter: run cell · Ctrl/⌘ + /: comment · Tab: indent · Esc: leave the editor

What you can do here

How it works

Python runs inside your browser using Pyodide, a version of CPython compiled to WebAssembly. The first run downloads it (about 10 MB, more for scikit-learn) and your browser keeps it for next time. Your code and files stay on your device. It runs in a background worker, so even an endless loop can be stopped without freezing the page.

Limits

PyTorch, TensorFlow and other packages with compiled code that is not built for the browser are not available, and code cannot reach the internet. For deep learning, export your work as a notebook and open it in Google Colab. Pure-Python packages can be added with import micropip; await micropip.install("package-name").

Examples

ExampleWhat it shows
Hello, PythonVariables, an f-string, a loop and a function.
Reading input()input() reads the lines in the Program input box below the code.
Average order value by countryJoin three tables with pandas and group by country.
Join orders to customersmerge() is pandas for SQL JOIN.
Top 5 products by revenueGroup, sum and sort.
Finding and handling missing valuesCount, fill and drop missing values.
Monthly revenue chartA bar chart with Matplotlib.
Predict house pricesLinear regression with scikit-learn and a train/test split.
Will the patient show up?A classifier with scikit-learn, scored with ROC-AUC.
Cluster flowers with k-meansUnsupervised learning on the iris data, with a scatter plot.
Running total per customerCumulative sums within groups (SQL window functions, pandas style).
Notebook mode: cellsLines starting with # %% split the code into cells. Click inside a cell and press Shift+Enter to run just that cell.
NumPy arrays and broadcastingVectorised maths without loops.

Learn more

New to Python? The free Python course starts from zero, with exercises that check your answers. Look up any function in the Python reference, or open one of the 60+ example programs. Every code example on the site has an "Open in playground" button.

Questions

Is this online Python compiler free?

Yes. There is no sign-up and no limit. It runs in your own browser, so there is no server cost to pass on.

Which Python version is it?

Python 3.12, through Pyodide 0.27, with the scientific stack built for the browser.

Can I use pandas and scikit-learn online?

Yes. Import them as usual; they load automatically the first time.

Why is the first run slow?

The first run downloads Python itself. After that your browser keeps it, so runs start quickly.

Is my code private?

Yes. It runs on your device and is not uploaded. Only if you press Share is it put into a link that you choose to give out.