Table of Contents
Python Code: 1. Create & Populate a Simple Table

Learn to create a Pixeltable directory and a basic table with string, integer, and float columns. Then, insert data and view the tables schema and contents.

1import pixeltable as pxt
2
3# Optional: Clean up previous runs for a fresh start in interactive sessions.
4# pxt.drop_dir('playground_core', force=True, ignore_not_found=True)
5# pxt.create_dir('playground_core')
6
7# Create a table for simple items
8items_table = pxt.create_table(
9 'playground_core.my_items',
10 {
11 'item_name': pxt.String,
12 'quantity': pxt.Int,
13 'price': pxt.Float
14 }
15)
16
17# Insert some data
18items_table.insert([
19 {'item_name': 'apple', 'quantity': 10, 'price': 0.5},
20 {'item_name': 'banana', 'quantity': 20, 'price': 0.75},
21 {'item_name': 'orange', 'quantity': 15, 'price': 0.6}
22])
23
24print("--- Table Schema (from items_table.describe()) ---")
25# print(items_table.describe()) # In a real session, this would print schema.
26print("\\n--- Table Data (from items_table.head()) ---")
27# print(items_table.head()) # In a real session, this shows first few rows.
28# For the playground, the output panel simulates these results.
Output Panel

Click 'Run' or press Shift+Enter to see the output.
(OUTPUT IS SIMULATED FOR THIS PLAYGROUND)

Quick Actions

Create RAG System

Multimodal Search

Build AI Agent

Custom Functions