AI-powered data analysis assistant built with Anthropic's Claude API. Works as both a command-line tool and has a simple web app for data manipulation, analysis, and visualization. You can use to quickly manipulate and export structured data files or ask some questions about said file.
pip install -r requirements.txt
python run_web.py
# Open http://localhost:8000from data_agent import DataAgent
agent = DataAgent()
agent.interactive_chat()- List Data Files: Discover all available data files in your workspace
- Search in Files: Find specific patterns across multiple data files
- Get File Info: Retrieve detailed metadata about data files
- Multi-Format Support: Load CSV, Excel, JSON, and Parquet files
- Smart Preview: View head/tail of datasets with formatted output
- Data Info: Get comprehensive information about loaded datasets
- Basic Statistics: Calculate mean, median, std dev, and more
- Data Profiling: Generate comprehensive column-by-column profiles
- Correlation Analysis: Find relationships between numeric variables
- Group By Analysis: Aggregate data with multiple functions
- Pivot Tables: Create pivot table summaries
- Filtering: Apply complex conditions to filter data
- Sorting: Sort by single or multiple columns
- Merging: Join datasets with various merge strategies
- Aggregation: Apply custom aggregation functions
- Column Transformation: Log, sqrt, normalize, scale, and more
- Column Operations: Add, remove, and rename columns
- Missing Value Handling: Multiple strategies including drop, fill, interpolate
- Duplicate Removal: Remove duplicate rows with flexible options
- Type Conversion: Convert between data types safely
- Outlier Detection: Identify outliers using IQR or Z-score methods
- Multi-Format Export: Save to CSV, Excel, JSON, or Parquet
- Filtered Export: Export subsets of data based on conditions
- SQL Queries: Execute SQL queries on loaded datasets using DuckDB
- Data Visualization: Create various charts (scatter, line, bar, heatmap, etc.)
- Machine Learning:
- K-means clustering
- Linear regression analysis
- Time Series Analysis: Analyze temporal data with rolling statistics
- SMS Notifications: Send SMS alerts via Twilio integration
- Interactive Chat: Natural language interface to all features
- Conversation Memory: Maintains context across interactions
-
Install dependencies:
pip install -r requirements.txt
-
Set up your API key: Create a
.envfile:ANTHROPIC_API_KEY=your-api-key-here TWILIO_ACCOUNT_SID=your-twilio-sid # Optional for SMS TWILIO_AUTH_TOKEN=your-twilio-token # Optional for SMS TWILIO_PHONE_NUMBER=your-twilio-phone # Optional for SMS
-
Run the web interface:
python run_web.py
-
Open your browser: Go to
http://localhost:8000 -
Upload & Chat:
- Drag and drop a data file (CSV, Excel, JSON, or Parquet)
- Chat with your data using natural language
- Export processed results
from data_agent import DataAgent
# Initialize the agent
agent = DataAgent()
# Start interactive chat
agent.interactive_chat()Basic Analysis:
- "Show me basic statistics"
- "What's the shape of this data?"
- "Tell me about missing values"
Data Exploration:
- "What are the correlations between columns?"
- "Show me outliers in the data"
- "Create a data profile"
Filtering & Manipulation:
- "Filter rows where sales > 1000"
- "Remove duplicate rows"
- "Fill missing values with the mean"
Visualizations:
- "Create a scatter plot of X vs Y"
- "Show me a correlation heatmap"
- "Make a histogram of the price column"
Advanced Analysis:
- "Run clustering analysis with 3 clusters"
- "Perform linear regression on this data"
- "Show time series trends"
# Load data
response = agent.send_message("Load the file data.csv")
# Analyze data
response = agent.send_message("Show me a data profile")
# Transform data
response = agent.send_message("Remove duplicates and handle missing values")
# Visualize
response = agent.send_message("Create a correlation heatmap")list_data_files: Find all data files in workspacesearch_in_files: Search for patterns in filesget_file_info: Get file metadata
load_data: Load data from various formatspreview_data: Preview dataset rowsget_data_info: Get dataset information
basic_statistics: Calculate descriptive statisticsdata_profile: Generate comprehensive profilecorrelation_analysis: Find correlationsgroup_by_analysis: Group and aggregate datapivot_table: Create pivot tables
filter_data: Filter with conditionssort_data: Sort by columnsmerge_data: Join datasetsaggregate_data: Apply aggregationstransform_column: Transform with functionsadd_column: Add new columnsremove_column: Remove columnsrename_columns: Rename columns
handle_missing: Handle missing valuesremove_duplicates: Remove duplicate rowsconvert_types: Convert data typesdetect_outliers: Find outliers
save_data: Save to fileexport_filtered: Export filtered data
sql_query: Execute SQL queriescreate_visualization: Generate chartsrun_clustering: K-means clusteringrun_regression: Linear regressiontime_series_analysis: Analyze time series
"DataAgent initialization failed"
- Check that
ANTHROPIC_API_KEYis set in your.envfile - Verify the API key is valid
"File type not supported"
- Only CSV, Excel, JSON, and Parquet files are supported
- Check the file extension is correct
"Upload failed"
- File might be too large (50MB limit)
- Check file isn't corrupted
- Ensure sufficient disk space
Web interface won't load
- Check if port 5000 is already in use
- Try running with
python web_app.pydirectly - Check console for error messages
- Python 3.8+
- Anthropic API key
- Optional: Twilio credentials for SMS functionality
- Backend: Flask web server with REST API
- Frontend: Vanilla JavaScript with modern CSS
- Data Processing: Pandas, NumPy, Scikit-learn, Plotly
- Database: DuckDB for SQL queries
- File Storage: Temporary uploads with session cleanup
- Security: Isolated user sessions, server-side API keys
MIT License
Contributions are welcome! Please feel free to submit a Pull Request.