pandas
DataData manipulation
What is pandas?
Pandas is the go-to Python library for data manipulation and analysis. It introduces two primary data structures — Series and DataFrame — that make it easy to load, transform, filter, group, merge, and export tabular data. Whether you're cleaning a CSV file, running aggregations, or preparing data for a machine learning model, Pandas makes the task dramatically simpler.
Running Pandas in PyRun requires zero setup. The library is pre-compiled into the Pyodide WebAssembly distribution and is imported automatically when your code uses it. You can paste a Pandas script, hit Run, and see the output instantly — all inside your browser tab, with no dependencies to manage.
Code Example
Filtering, grouping, and aggregating tabular data.
Pandas DataFrame
Try in Editorimport pandas as pd
data = {
'Name': ['Alice', 'Bob', 'Charlie', 'Diana'],
'Age': [24, 27, 22, 32],
'Score': [85, 92, 78, 95],
'City': ['NYC', 'London', 'Berlin', 'Tokyo'],
}
df = pd.DataFrame(data)
print("DataFrame:\n")
print(df)
print("\nAverage Score:", df['Score'].mean())
print("\nTop scorers (>80):")
print(df[df['Score'] > 80][['Name', 'Score']])
print("\nGrouped by City mean score:")
print(df.groupby('City')['Score'].mean())Why run pandas in PyRun?
- ✦ Zero setup — no pip install, no virtual environment, no Python download
- ✦ Instant results — powered by WebAssembly, runs locally in your browser
- ✦ Share your code — generate a link and anyone can run it instantly
- ✦ Works offline — after first load, PyRun runs without internet