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.
import 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
Related Packages
Recommended Python Resources
Expand your knowledge with related interactive tutorials, cheat sheets, and code comparisons.
Python Loops
Learn how to use Python loops to iterate over data. Master for loops, while loops, break, continue, and loop best practices with interactive examples.
How to Sort a List in Python
Learn how to sort a list in Python using the sort() method and the sorted() function. Discover custom key sorting and reverse order examples.
Python Pandas Data Analysis
Reference guide for Pandas Series and DataFrames. Learn data loading, cleaning, selection, grouping, and aggregations.
Python vs JavaScript: Which Programming Language is Best?
A comprehensive comparison between Python and JavaScript. Explore syntax differences, performance, use cases (backend vs frontend), and coding examples.