Skip to content

Pandas Integration

Use pandas to analyze Komodo data with familiar DataFrame operations.

Install Pandas to your existing uv project.

Section titled “Install Pandas to your existing uv project.”
Terminal window
uv add pandas

The connection from get_snowflake_connection() works seamlessly with pandas:

from komodo import get_snowflake_connection
import pandas as pd
# Get connection
conn = get_snowflake_connection()
cursor = conn.cursor()
cursor.execute("USE DATABASE DATA")
query = "SELECT column_name, table_name FROM INFORMATION_SCHEMA.COLUMNS;"
# Fetch the result set from the cursor and deliver it as the pandas DataFrame.
cursor.execute(query)
df = cursor.fetch_pandas_all()
# https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-api#fetch_pandas_all
print(df.head(20))
print("total rows:", len(df))

Save DataFrame to various formats:

# Export to CSV
df.to_csv('results.csv', index=False)
# Export to Parquet
df.to_parquet('results.parquet', index=False)