Guides
Create a Database File
Ibis can work with several file types, but at its core, it connects to existing databases and interacts with the data there. You can get started with your own DuckDB databases or create a new one with example data.  
```python
import ibis

con = ibis.connect("duckdb://penguins.ddb")
con.create_table(
"penguins", ibis.examples.penguins.fetch().to_pyarrow(), overwrite = True
)
```  
```python
# Output:
DatabaseTable: penguins
species           string
island            string
bill_length_mm    float64
bill_depth_mm     float64
flipper_length_mm int64
body_mass_g       int64
sex               string
year              int64
```  
You can now see the example dataset copied over to the database:  
```python
# reconnect to the persisted database (dropping temp tables)
con = ibis.connect("duckdb://penguins.ddb")
con.list_tables()
```  
```python
# Output:
['penguins']
```  
There's one table, called `penguins`. We can ask Ibis to give us an object that we can interact with.  
```python
penguins = con.table("penguins")
penguins
```  
```text
# Output:
DatabaseTable: penguins
species           string
island            string
bill_length_mm    float64
bill_depth_mm     float64
flipper_length_mm int64
body_mass_g       int64
sex               string
year              int64
```  
Ibis is lazily evaluated, so instead of seeing the data, we see the schema of the table. To peek at the data, we can call `head` and then `to_pandas` to get the first few rows of the table as a pandas DataFrame.  
```python
penguins.head().to_pandas()
```  
```text
species     island  bill_length_mm  bill_depth_mm  flipper_length_mm  body_mass_g     sex  year
0  Adelie  Torgersen            39.1           18.7              181.0       3750.0    male  2007
1  Adelie  Torgersen            39.5           17.4              186.0       3800.0  female  2007
2  Adelie  Torgersen            40.3           18.0              195.0       3250.0  female  2007
3  Adelie  Torgersen             NaN            NaN                NaN          NaN    None  2007
4  Adelie  Torgersen            36.7           19.3              193.0       3450.0  female  2007
```  
`to_pandas` takes the existing lazy table expression and evaluates it. If we leave it off, you'll see the Ibis representation of the table expression that `to_pandas` will evaluate (when you're ready!).  
```python
penguins.head()
```  
```python
# Output:
r0 := DatabaseTable: penguins
species           string
island            string
bill_length_mm    float64
bill_depth_mm     float64
flipper_length_mm int64
body_mass_g       int64
sex               string
year              int64

Limit[r0, n=5]
```  
Ibis returns results as a pandas DataFrame using `to_pandas`, but isn't using pandas to perform any of the computation. The query is executed by DuckDB. Only when `to_pandas` is called does Ibis then pull back the results and convert them into a DataFrame.