Metadata-Version: 2.4
Name: google-pandas-agent
Version: 0.1.2
Summary: Google‑native alternative to LangChain's create_pandas_dataframe_agent
Author-email: Ariamehr Maleki <ariamehr.mai@gmail.com>, Frank Roh <frankagilepm@gmail.com>, Darren North <denorth222@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/yourusername/google-pandas-agent
Project-URL: Documentation, https://github.com/yourusername/google-pandas-agent#readme
Project-URL: Repository, https://github.com/yourusername/google-pandas-agent.git
Project-URL: Issues, https://github.com/yourusername/google-pandas-agent/issues
Keywords: gemini,pandas,agent,langgraph,google-generativeai,dataframe,analysis
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=2.2.0
Requires-Dist: google-generativeai>=0.8.5
Requires-Dist: langgraph>=0.3.21
Requires-Dist: typing-extensions>=4.9.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: black>=23.0; extra == "dev"
Requires-Dist: isort>=5.0; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Provides-Extra: all
Requires-Dist: numpy>=1.24.0; extra == "all"
Requires-Dist: matplotlib>=3.7.0; extra == "all"
Requires-Dist: seaborn>=0.12.0; extra == "all"
Dynamic: license-file

# Google Pandas Agent

A Google-native alternative to LangChain's create_pandas_dataframe_agent, powered by Google's Gemini models and LangGraph.

## Features

- Query pandas DataFrames using natural language
- Powered by Google's Gemini models
- Simple, intuitive interface
- Type-safe implementation
- Comprehensive error handling
- Support for multiple DataFrames

## Installation

```bash
pip install google-pandas-agent
```

## Requirements

- Python >= 3.10
- pandas >= 2.2
- google-generativeai >= 0.8.5
- langgraph >= 0.3.21

## Quick Start

```python
import pandas as pd
import google.generativeai as genai
from google_pandas_agent import create_pandas_dataframe_agent

# Initialize Gemini
genai.configure(api_key='your-api-key')  # Get your API key from Google Cloud Console
model = genai.GenerativeModel('gemini-pro')

# Create a sample DataFrame
df = pd.DataFrame({
    'Name': ['Alice', 'Bob', 'Charlie'],
    'Age': [25, 30, 35],
    'City': ['New York', 'London', 'Paris']
})

# Create the agent
agent = create_pandas_dataframe_agent(model, df)

# Ask questions about your data
response = agent.chat("What is the average age?")
print(response)

# You can also use multiple DataFrames
df2 = pd.DataFrame({
    'City': ['New York', 'London', 'Paris'],
    'Country': ['USA', 'UK', 'France']
})

agent = create_pandas_dataframe_agent(model, [df, df2])
response = agent.chat("Show me people's names along with their countries")
print(response)
```

## API Reference

### create_pandas_dataframe_agent

```python
def create_pandas_dataframe_agent(
    llm: genai.GenerativeModel,
    df: Union[pd.DataFrame, List[pd.DataFrame]],
    *,
    verbose: bool = False,
    allow_dangerous_code: bool = False,
    **kwargs,
) -> AgentExecutor
```

Creates an agent that can answer questions about pandas DataFrames.

#### Parameters

- `llm`: A Gemini model instance (must be initialized with `genai.GenerativeModel`)
- `df`: A pandas DataFrame or list of DataFrames
- `verbose`: Enable verbose output (default: False)
- `allow_dangerous_code`: Allow potentially unsafe imports in the Python REPL (default: False)
- `**kwargs`: Additional arguments passed to the executor

#### Returns

An `AgentExecutor` instance that can process natural language queries about the DataFrame(s)

### AgentExecutor

The main class for executing queries against DataFrames.

#### Methods

- `chat(question: str) -> str`: Process a natural language query and return the response
- `run(question: str) -> str`: Alias for chat()
- `invoke(state: dict) -> dict`: Advanced method for custom state handling

## Common Issues and Solutions

1. **Import Error**: If you get an error about missing dependencies, make sure you have all required packages installed:
   ```bash
   pip install "google-pandas-agent[all]"
   ```

2. **API Key Error**: Make sure to configure your Google API key before creating the model:
   ```python
   genai.configure(api_key='your-api-key')
   ```

3. **Model Error**: Ensure you're using the correct model name ('gemini-pro'):
   ```python
   model = genai.GenerativeModel('gemini-pro')
   ```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License - see the LICENSE file for details.

## Authors

- Ariamehr Maleki (ariamehr.mai@gmail.com)
- Frank Roh (frankagilepm@gmail.com)
- Darren North (denorth222@gmail.com) 
