Legacy documentation for SmartDatalake class
pai.chat()
pai.config.set()
# Old code from pandasai import SmartDatalake, SmartDataframe lake = SmartDatalake([ SmartDataframe(customers_df), SmartDataframe(orders_df) ]) response = lake.chat("Query across dataframes") # New code import pandasai as pai df_customers = pai.DataFrame(customers_df) df_orders = pai.DataFrame(orders_df) response = pai.chat("Query across dataframes", df_customers, df_orders)
from pandasai import SmartDatalake, SmartDataframe import pandas as pd # Create sample dataframes customers_df = pd.DataFrame({ 'customer_id': [1, 2, 3], 'name': ['John', 'Emma', 'Alex'] }) orders_df = pd.DataFrame({ 'order_id': [101, 102, 103], 'customer_id': [1, 2, 1], 'amount': [100, 200, 150] }) # Convert to SmartDataframes smart_customers = SmartDataframe(customers_df) smart_orders = SmartDataframe(orders_df) # Create SmartDatalake lake = SmartDatalake([smart_customers, smart_orders]) # Ask questions spanning multiple dataframes response = lake.chat("What is the total order amount for each customer?")
lake = SmartDatalake( [smart_customers, smart_orders], config={ "llm": llm, "verbose": True } )
Was this page helpful?