Skip to main content
While DataStore is highly compatible with pandas, there are important differences to understand.

Summary Table


  1. Lazy vs Eager Execution

pandas (Eager)

Operations execute immediately:

DataStore (Lazy)

Operations are deferred until results are needed:

Why It Matters

Lazy execution enables:
  • Query optimization: Multiple operations compile to one SQL query
  • Column pruning: Only needed columns are read
  • Filter pushdown: Filters apply at the source
  • Memory efficiency: Don’t load data you don’t need

  1. Return Types

pandas

DataStore

Converting to pandas Types


  1. Execution Triggers

DataStore executes when you need actual values:

Operations That Stay Lazy


  1. Row Order

pandas

Row order is always preserved:

DataStore

Row order is automatically preserved for most operations:
DataStore automatically tracks original row positions internally (using rowNumberInAllBlocks()) to ensure order consistency with pandas.

When Order Is Preserved

  • File sources (CSV, Parquet, JSON, etc.)
  • pandas DataFrame sources
  • Filter operations
  • Column selection
  • After explicit sort() or sort_values()
  • Operations that define order (nlargest(), nsmallest(), head(), tail())

When Order May Differ

  • After groupby() aggregations (use sort_values() to ensure consistent order)
  • After merge() / join() with certain join types
  • In performance mode (config.use_performance_mode()): row order is not guaranteed for any operation. See Performance Mode.

  1. No inplace Parameter

pandas

DataStore

inplace=True is not supported. Always assign the result:

Why No inplace?

DataStore uses immutable operations to enable:
  • Query building (lazy evaluation)
  • Thread safety
  • Easier debugging
  • Cleaner code

  1. Index Support

pandas

Full index support:

DataStore

Simplified index support:

DataStore Source Matters

  • DataFrame source: Preserves pandas index
  • File source: Uses simple integer index

  1. Comparison Behavior

Comparing with pandas

pandas doesn’t recognize DataStore objects:

Using equals()


  1. Type Inference

pandas

Uses numpy/pandas types:

DataStore

May use ClickHouse types:

Explicit Casting


  1. Memory Model

pandas

All data lives in memory:

DataStore

Data stays at source until needed:

  1. Error Messages

Different Error Sources

  • pandas errors: From pandas library
  • DataStore errors: From chDB or ClickHouse

Debugging Tips


Migration Checklist

When migrating from pandas:
  • Change import statement
  • Remove inplace=True parameters
  • Add explicit to_df() where pandas DataFrame is required
  • Add sorting if row order matters
  • Use to_pandas() for comparison tests
  • Test with representative data sizes

Quick Reference

Last modified on June 12, 2026