Examples¶
Practical examples in Jupyter Notebooks to learn DataFrameIt.
Available Notebooks¶
Examples are organized from basic to advanced. We recommend following in order.
1. Basic¶
Introduction to DataFrameIt with sentiment analysis.
- Create simple Pydantic model
- Process basic DataFrame
- Understand the output
from pydantic import BaseModel
from typing import Literal
class Sentiment(BaseModel):
sentiment: Literal['positive', 'negative', 'neutral']
2. Error Handling¶
How to handle errors and configure retry.
- Configure
max_retries,base_delay,max_delay - Check
_dataframeit_statuscolumn, which only appears when some row fails - Analyze
_error_details
3. Incremental Processing¶
Continue processing from where it stopped.
- Save checkpoints with
batch_sizeandcheckpoint_path - Reload with
read_dfand continue withresume=True - Reprocess only error rows
4. Prompt and Text Column¶
Control where text appears in the prompt and which column it comes from.
- Place
{texto}in the template, or let the text go at the end - Inference of
text_columnand when to set it - Rows with empty text
5. Advanced Case: Legal Analysis¶
Real example with complex Pydantic model.
- Nested models
- Optional fields
- Lists of objects
- Multiple entity extraction
class Party(BaseModel):
name: str
type: Literal['plaintiff', 'defendant']
class Decision(BaseModel):
parties: List[Party]
outcome: Literal['granted', 'denied']
6. Polars¶
Use DataFrameIt with Polars instead of Pandas.
- Input with
polars.DataFrame - Output preserves Polars type
7. Multiple Data Types¶
Process different input types.
- Lists
- Dictionaries
- Series
8. Rate Limiting¶
Control request rate.
- Configure
rate_limit_delay - Use
parallel_requests - Combine for maximum efficiency
9. Web Search¶
Script with agent-based web search.
use_search,search_per_fieldandsave_trace- Tavily or Exa as the search provider
Running the Examples¶
1. Clone the Repository¶
2. Install Dependencies¶
3. Configure your API Key¶
4. Run Jupyter¶
Contributing Examples¶
If you created an interesting example, consider contributing! Open an issue or pull request on GitHub.