Data science code execution API
Run pandas, NumPy, scikit-learn, DuckDB and R code from your course platform, practice site or AI tool, with the data files the code needs. Charts come back as images, and run-tests grades the answers. The packages are pinned and published, so expected outputs stay stable.
Runtimes and packages
| Compiler id | What it runs |
|---|---|
python-3.14 | Python 3.14 with numpy 2.5.4, pandas 3.0.6, scipy 1.18.1, scikit-learn 1.9.1, matplotlib 3.11.2, seaborn 0.13.2, statsmodels 0.15.0, sympy 1.14.0, openpyxl 3.1.5, pillow 13.0.0, duckdb 1.5.6, wordcloud 1.9.6, polars 2.1.0, pgmpy 1.1.2, nltk 3.10.4 |
python-3.14-pandas2 | The same, with pandas 2.3.3 |
duckdb-1.5 | DuckDB 1.5 SQL; DuckDB is also importable from Python |
sqlite-3 | SQLite SQLite 3 SQL |
r-4.6 | R 4.6 with its recommended packages (MASS, lattice, Matrix, mgcv, nlme, rpart, survival and others); no ggplot2 or tidyverse |
The package versions are in the package table, and GET /api/compilers/ returns them. Other PyPI packages are not installed, and runs have no network.
Every other language has its standard library; the languages page lists all of them.
Data files in, charts and files out
Send up to 20 files with a run, 1 MB in total, and the code reads each by
its name. Files the program writes to its output directory come back in the response's files, up to
8 files and 2 MB, if they are one of these types: png, svg, csv, json, txt. plt.show() saves each figure as figure-N.png. Returned files are kept
60 days.
curl -X POST https://api.onlinecompiler.io/api/run-code-sync/ \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"compiler": "python-3.14",
"code": "import pandas as pd\nimport matplotlib.pyplot as plt\n\ndf = pd.read_csv(\"orders.csv\")\ntotals = df.groupby(\"region\")[\"amount\"].sum()\nprint(totals)\ntotals.plot.bar()\nplt.show()",
"files": [
{"name": "orders.csv", "content": "region,amount\nnorth,10\nsouth,20\nnorth,5\n"}
]
}'The response has the printed totals in output and the bar chart as figure-1.png in files. The API docs cover the fields.
Grade data answers
POST /api/run-tests/ runs the code against each test and returns a verdict per test. For a DataFrame
or a query result, print it as CSV with its header (print(df.to_csv(index=False))) and use the table checker: it matches columns by name and rows in any order, ignores pandas' index column, treats
empty, NaN, None, NULL and <NA> as the same missing value and compares numbers within a tolerance
(table_ordered also checks the row order). For answers printed one row per line without a header, rows ignores row order; float compares numbers in order, for scores and statistics. The
data file is shared by every test:
curl -X POST https://api.onlinecompiler.io/api/run-tests/ \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"compiler": "python-3.14",
"code": "import pandas as pd\n\ndf = pd.read_csv(\"orders.csv\")\nfor region, total in df.groupby(\"region\")[\"amount\"].sum().items():\n print(region, total)",
"files": [
{"name": "orders.csv", "content": "region,amount\nnorth,10\nsouth,20\nnorth,5\n"}
],
"tests": [{"input": "", "expected_output": "south 20\nnorth 15\n"}],
"checker": "rows"
}'{
"verdict": "accepted",
"score": 100,
"passed": 1,
"total": 1,
"tests": [
{"verdict": "accepted", "output": "north 15\nsouth 20\n", "exit_code": 0, "...": "..."}
]
}For a course or an assessment, store the problem once: its data files, hidden tests, a driver around the candidate's code and, if the output needs judgement, a custom checker. Every result can carry a signed receipt. See run-tests, stored problems and the guide to auto-grading SQL exercises.
Who uses it for data science
- Course and practice platforms that run learners' pandas, SQL and scikit-learn code inside a lesson, with the embeddable editor or the API.
- AI tutors and interview tools that need a model's or a candidate's code run and checked; the MCP server gives the same runtimes to AI assistants.
- Assessment builders grading data questions with hidden tests: see the autograder API.
- Universities on Moodle CodeRunner, whose Python questions import numpy and matplotlib: the hosted Jobe server has them installed.
How it compares
| Python data stack | Package list published | Charts and files out | How it is sold | |
|---|---|---|---|---|
| OnlineCompiler.io | pandas, NumPy, SciPy, scikit-learn, statsmodels, Matplotlib, seaborn, DuckDB | Yes, with versions | Yes: png, svg, csv, json, txt | Included in every plan, free up to 100,000 runs a month |
| Judge0 Extra CE | 198 packages in its Python 3.14 "Python for ML" image (probed 19 Oct 2026) | No | Text only | Separate RapidAPI subscription, from $44.99 a month |
| Sphere Engine | numpy, pandas, scipy, matplotlib and tensorflow named for Python | Names only, no versions | Images on stdout and named files (beta) | By quote |
| Codapi | pandas, scikit-learn, Matplotlib, seaborn (sandbox file) | Names only, no versions | SVG or HTML printed to stdout, in its widget | From $5 a month for 5,000 runs; runs get 128 MB and 8 s (box.json) |
Limits
- Each run gets 30 seconds, 512 MB of memory (up to 2 GB on Pro and Business) and 2 CPUs, with no network.
- Each request starts a fresh sandbox: it runs scripts, not notebooks, and keeps nothing between requests.
- No GPU, PyTorch or TensorFlow. Deep learning belongs on a GPU notebook service.
Try it
The pandas, Matplotlib and machine learning online compilers run the same runtime in the browser with no sign-in. For your own app, make a free key: 100,000 runs a month, commercial use included.
Frequently asked questions
Which data science packages are installed, and which versions?
The python-3.14 runtime has numpy 2.5.4, pandas 3.0.6, scipy 1.18.1, scikit-learn 1.9.1, matplotlib 3.11.2, seaborn 0.13.2, statsmodels 0.15.0, sympy 1.14.0, openpyxl 3.1.5, pillow 13.0.0, duckdb 1.5.6, wordcloud 1.9.6, polars 2.1.0, pgmpy 1.1.2, nltk 3.10.4. The versions are pinned and published, and GET /api/compilers/ returns them with each runtime, so a question bank or an AI tool knows exactly what its code runs on.
Can I pin pandas 2?
Yes. The compiler id python-3.14-pandas2 has the same packages with pandas 2.3.3, for code and expected outputs written against pandas 2. Use python-3.14 for pandas 3.
Do charts come back?
Yes. plt.show() saves each Matplotlib figure as a PNG, and any file the program writes to its output directory comes back if it is one of these types: png, svg, csv, json, txt. A run returns up to 8 files and 2 MB, each with its content in base64 and a link.
Is there a GPU?
No. Runs use CPUs only, and PyTorch and TensorFlow are not installed. The runtime is for pandas, NumPy, SQL, statistics, charts and classical machine learning on course-sized data.
Can it run Jupyter notebooks?
No. It runs scripts: each request starts a fresh sandbox, runs the code from top to bottom and returns the output, so nothing is kept between requests. Join the cells of a notebook into one script to run it.
How long are returned files kept?
60 days. A stored file's url works for that long, and the content is also in the response itself as base64.