Code Mode
Code Mode provides a Python-first environment for data analysis, visualization, and file manipulation.
Overview
When you select Code Mode, you’re working with the Data Agent—an AI assistant specialized in:
- Writing and executing Python code
- Analyzing data files in your workspace
- Creating visualizations
- Building data pipelines
- Generating downloadable artifacts
Getting Started
Switching to Code Mode
- Open Deep Data Agent from the Hub
- Look for the mode selector at the top of the chat
- Click Code to enable Code Mode
Your First Analysis
Try a simple prompt:
Load the sales.csv file and show me a summary of the dataThe agent will:
- Write Python code to load your file
- Execute it in a secure sandbox
- Display the results inline
- Show you the code it used
Working with Files
Uploading Files
Drag and drop files directly into the chat, or use the upload button. Supported formats:
- Tabular: CSV, Excel (.xlsx, .xls), Parquet, JSON
- Text: TXT, Markdown, PDF
- Code: Python, JavaScript, SQL
Referencing Files
Reference files by name in your prompts:
Analyze the customer_data.csv fileCompare sales_2023.xlsx with sales_2024.xlsxRead the README.md and summarize itFile Operations
The agent can create, modify, and export files:
Clean the data and save it as cleaned_data.parquetExport the results to an Excel fileCreate a Python script that automates this analysisData Analysis
Exploratory Analysis
Show me the shape, columns, and data types of orders.csvWhat are the summary statistics for all numeric columns?Are there any missing values? Show me a breakdown by columnFiltering and Querying
Show me all orders over $1000 from CaliforniaGroup sales by region and calculate the averageFind the top 10 customers by total purchase amountTransformations
Create a new column for profit margin (revenue - cost) / revenueConvert the date column to datetime and extract monthNormalize the price column to a 0-1 scaleVisualizations
Basic Charts
Create a bar chart of sales by regionShow me a line chart of monthly revenue trendsMake a scatter plot of price vs quantityAdvanced Visualizations
Create a heatmap showing correlation between numeric columnsBuild a dashboard with sales by region, monthly trends, and top productsShow me a box plot of order values grouped by customer segmentCustomization
Make the chart larger with a dark backgroundAdd a title and axis labelsUse the Calliope brand colors (provide hex codes)Code Execution
Viewing Generated Code
Every response includes the Python code used. Click “Show Code” to see it.
Modifying Code
Ask the agent to adjust its approach:
Use pandas instead of polars for this analysisAdd error handling for missing filesMake the code more efficient for large datasetsRunning Custom Code
You can provide your own code:
Run this code:
import pandas as pd
df = pd.read_csv('data.csv')
print(df.describe())Available Libraries
Code Mode has common data science libraries pre-installed:
| Category | Libraries |
|---|---|
| Data | pandas, polars, numpy |
| Visualization | matplotlib, seaborn, plotly |
| Machine Learning | scikit-learn, xgboost |
| Statistics | scipy, statsmodels |
| Utilities | requests, beautifulsoup4 |
Need a library that’s not available? Let us know.
Artifacts and Downloads
Creating Downloadable Files
Save the cleaned data as a CSV I can downloadExport the chart as a PNGCreate a PDF report with the analysisAccessing Downloads
Generated files appear as download links in the chat. Click to download directly.
Best Practices
Be Specific
Instead of: “Analyze this data”
Try: “Calculate the monthly growth rate and identify which products are declining”
Iterate
Start broad, then refine:
- “Show me a summary of the data”
- “Focus on the revenue column”
- “Break it down by region”
- “Show just Q4 2024”
Use Context
Reference previous results:
Using that filtered data, create a visualizationApply the same transformation to the other fileRequest Formats
Be explicit about output format:
Show this as a tableGive me a chart, not a tableExport as Excel with multiple sheetsTroubleshooting
“File not found”
- Check the exact filename (case-sensitive)
- Make sure the file was uploaded successfully
- Try listing files: “What files are in my workspace?”
Slow responses
- Large files take longer to process
- Complex visualizations need more time
- Try working with a sample first: “Analyze the first 1000 rows”
Unexpected results
- Ask to see the code: “Show me the code you used”
- Check data types: “What are the column types?”
- Verify the data: “Show me the first 10 rows”