title_wip

*Benchmark on 10M rows*

---

## Troubleshooting Migration[​](#troubleshooting "Direct link to Troubleshooting Migration")

### Issue: Operation Not Working[​](#issue-op "Direct link to Issue: Operation Not Working")

Some pandas operations may not be supported. Check:

1. Is the operation in the [compatibility list](/docs/chdb/datastore/pandas-compat)?
2. Try converting to pandas first: `ds.to_df().operation()`

### Issue: Different Results[​](#issue-results "Direct link to Issue: Different Results")

Enable debug logging to understand what's happening:

```
from chdb.datastore.config import config
config.enable_debug()

# View the SQL being generated
ds.filter(ds['x'] > 10).explain()
```

### Issue: Slow Performance[​](#issue-slow "Direct link to Issue: Slow Performance")

Check your execution pattern:

```
# Bad: Multiple small executions
for i in range(1000):
    result = ds.filter(ds['id'] == i).to_df()

# Good: Single execution
result = ds.filter(ds['id'].isin(ids)).to_df()
```

### Issue: Type Mismatches[​](#issue-types "Direct link to Issue: Type Mismatches")

DataStore may infer types differently:

```
# Check types
print(ds.dtypes)

# Force conversion
ds['col'] = ds['col'].astype('int64')
```

---

## Gradual Migration Strategy[​](#gradual "Direct link to Gradual Migration Strategy")

### Week 1: Test Compatibility[​](#week-1 "Direct link to Week 1: Test Compatibility")

```
# Keep both imports
import pandas as pd
from chdb import datastore as ds

# Compare results
pdf = pd.read_csv("data.csv")
dsf = ds.read_csv("data.csv")

# Verify they match
assert pdf.equals(dsf.to_pandas())
```

### Week 2: Switch Simple Scripts[​](#week-2 "Direct link to Week 2: Switch Simple Scripts")

Start with scripts that:

- Read large files
- Do filtering and aggregation
- Don't use custom apply functions

### Week 3: Handle Complex Cases[​](#week-3 "Direct link to Week 3: Handle Complex Cases")

For scripts with custom functions:

```
from chdb import datastore as pd

# Let DataStore handle the heavy lifting
ds = pd.read_csv("data.csv")
ds = ds.filter(ds['year'] == 2024)  # SQL

# Convert for custom work
df = ds.to_df()
result = df.apply(my_custom_function)
```

### Week 4: Full Migration[​](#week-4 "Direct link to Week 4: Full Migration")

Switch all scripts to DataStore import.

---

## FAQ[​](#faq "Direct link to FAQ")

### Can I use both pandas and DataStore?[​](#faq-both "Direct link to Can I use both pandas and DataStore?")

Yes! Convert between them freely:

```
from chdb import datastore as ds
import pandas as pd

# DataStore to pandas
df = ds_result.to_pandas()

# pandas to DataStore  
ds = ds.DataFrame(pd_result)
```

### Will my tests still pass?[​](#faq-tests "Direct link to Will my tests still pass?")

Most tests should pass. For comparison tests, convert to pandas:

```
def test_my_function():
    result = my_function()
    expected = pd.DataFrame(...)
    pd.testing.assert_frame_equal(result.to_pandas(), expected)
```

### Can I use DataStore in Jupyter?[​](#faq-jupyter "Direct link to Can I use DataStore in Jupyter?")

Yes! DataStore works in Jupyter notebooks:

```
from chdb import datastore as pd

ds = pd.read_csv("data.csv")
ds.head()  # Displays nicely in Jupyter
```

### How do I report issues?[​](#faq-issues "Direct link to How do I report issues?")

If you find compatibility issues, report them at:
<https://github.com/chdb-io/chdb/issues>

- [The One-Line Migration](#one-line)- [Step-by-Step Migration](#step-by-step)
    - [Install chDB](#step-1)- [Change the Import](#step-2)- [Test Your Code](#step-3)- [Handle Any Differences](#step-4)- [What Works Unchanged](#works-unchanged)
      - [Data Loading](#loading-unchanged)- [Filtering](#filtering-unchanged)- [Selection](#selection-unchanged)- [GroupBy and Aggregation](#groupby-unchanged)- [Sorting](#sorting-unchanged)- [String Operations](#string-unchanged)- [DateTime Operations](#datetime-unchanged)- [I/O Operations](#io-unchanged)- [Key Differences](#differences)
        - [1. Lazy Evaluation](#lazy)- [2. Return Types](#return-types)- [3. No inplace Parameter](#no-inplace)- [4. Comparing DataStores](#comparing)- [5. Row Order](#row-order)- [Migration Patterns](#patterns)
          - [Pattern 1: Read-Analyze-Write](#pattern-1)- [Pattern 2: DataFrame with pandas Operations](#pattern-2)- [Pattern 3: Mixed Workflow](#pattern-3)- [Performance Comparison](#performance)- [Troubleshooting Migration](#troubleshooting)
              - [Issue: Operation Not Working](#issue-op)- [Issue: Different Results](#issue-results)- [Issue: Slow Performance](#issue-slow)- [Issue: Type Mismatches](#issue-types)- [Gradual Migration Strategy](#gradual)
                - [Week 1: Test Compatibility](#week-1)- [Week 2: Switch Simple Scripts](#week-2)- [Week 3: Handle Complex Cases](#week-3)- [Week 4: Full Migration](#week-4)- [FAQ](#faq)
                  - [Can I use both pandas and DataStore?](#faq-both)- [Will my tests still pass?](#faq-tests)- [Can I use DataStore in Jupyter?](#faq-jupyter)- [How do I report issues?](#faq-issues)

Was this page helpful?