1<!DOCTYPE html> 2<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head> 3 4<meta charset="utf-8"> 5<meta name="generator" content="quarto-1.9.18"> 6 7<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> 8 9 10<title>10 minutes to Ibis â Ibis</title> 11<style> 12/* Default styles provided by pandoc. 13** See https://pandoc.org/MANUAL.html#variables-for-html for config info. 14*/ 15code{white-space: pre-wrap;} 16span.smallcaps{font-variant: small-caps;} 17div.columns{display: flex; gap: min(4vw, 1.5em);} 18div.column{flex: auto; overflow-x: auto;} 19div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} 20ul.task-list{list-style: none;} 21ul.task-list li input[type="checkbox"] { 22 width: 0.8em; 23 margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */ 24 vertical-align: middle; 25} 26/* CSS for syntax highlighting */ 27html { -webkit-text-size-adjust: 100%; } 28pre > code.sourceCode { white-space: pre; position: relative; } 29pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } 30pre > code.sourceCode > span:empty { height: 1.2em; } 31.sourceCode { overflow: visible; } 32code.sourceCode > span { color: inherit; text-decoration: inherit; } 33div.sourceCode { margin: 1em 0; } 34pre.sourceCode { margin: 0; } 35@media screen { 36div.sourceCode { overflow: auto; } 37} 38@media print { 39pre > code.sourceCode { white-space: pre-wrap; } 40pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } 41} 42pre.numberSource code 43 { counter-reset: source-line 0; } 44pre.numberSource code > span 45 { position: relative; left: -4em; counter-increment: source-line; } 46pre.numberSource code > span > a:first-child::before 47 { content: counter(source-line); 48 position: relative; left: -1em; text-align: right; vertical-align: baseline; 49 border: none; display: inline-block; 50 -webkit-touch-callout: none; -webkit-user-select: none; 51 -khtml-user-select: none; -moz-user-select: none; 52 -ms-user-select: none; user-select: none; 53 padding: 0 4px; width: 4em; 54 } 55pre.numberSource { margin-left: 3em; padding-left: 4px; } 56div.sourceCode 57 { } 58@media screen { 59pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } 60} 61</style> 62 63
64<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js" integrity="sha384-ZvpUoO/+PpLXR1lu4jmpXWu80pZlYUAfxl5NsBMWOEPSjUn/6Z/hRTt8+pR6L4N2" crossorigin="anonymous"></script>
64<script src="../site_libs/quarto-nav/quarto-nav.js"></script>
vendor: 1 bytes, line 64
64
65<script src="../site_libs/quarto-nav/headroom.min.js"></script>
vendor: 1 bytes, line 65
65
66<script src="../site_libs/clipboard/clipboard.min.js"></script>
vendor: 1 bytes, line 66
66
67<script src="../site_libs/quarto-search/autocomplete.umd.js"></script>
vendor: 1 bytes, line 67
67
68<script src="../site_libs/quarto-search/fuse.min.js"></script>
vendor: 1 bytes, line 68
68
69<script src="../site_libs/quarto-search/quarto-search.js"></script>
vendor: 1 bytes, line 69
69
70<script src="../site_libs/quarto-search/autocomplete-preset-algolia.umd.js"></script>
70 71<meta name="quarto:offset" content="../"> 72<link href="../logo.svg" rel="icon" type="image/svg+xml">
73<script src="../site_libs/quarto-html/quarto.js" type="module"></script>
vendor: 1 bytes, line 73
73
74<script src="../site_libs/quarto-html/tabsets/tabsets.js" type="module"></script>
vendor: 1 bytes, line 74
74
75<script src="../site_libs/quarto-html/axe/axe-check.js" type="module"></script>
vendor: 1 bytes, line 75
75
76<script src="../site_libs/quarto-html/popper.min.js"></script>
vendor: 1 bytes, line 76
76
77<script src="../site_libs/quarto-html/tippy.umd.min.js"></script>
vendor: 1 bytes, line 77
77
78<script src="../site_libs/quarto-html/anchor.min.js"></script>
78 79<link href="../site_libs/quarto-html/tippy.css" rel="stylesheet"> 80<link href="../site_libs/quarto-html/quarto-syntax-highlighting-fafd091245ca516cc2c8c2b2c7d0cd5e.css" rel="stylesheet" class="quarto-color-scheme" id="quarto-text-highlighting-styles"> 81<link href="../site_libs/quarto-html/quarto-syntax-highlighting-dark-8d865482300dacf2543a97eef29e18b5.css" rel="stylesheet" class="quarto-color-scheme quarto-color-alternate" id="quarto-text-highlighting-styles"> 82<link href="../site_libs/quarto-html/quarto-syntax-highlighting-fafd091245ca516cc2c8c2b2c7d0cd5e.css" rel="stylesheet" class="quarto-color-scheme-extra" id="quarto-text-highlighting-styles">
83<script src="../site_libs/bootstrap/bootstrap.min.js"></script>
83 84<link href="../site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet"> 85<link href="../site_libs/bootstrap/bootstrap-e4b02b9d8ec73f0e62ff208b9459ea2c.min.css" rel="stylesheet" append-hash="true" class="quarto-color-scheme" id="quarto-bootstrap" data-mode="light"> 86<link href="../site_libs/bootstrap/bootstrap-dark-a025b3cfc189dfe3454a41e1472c33fe.min.css" rel="stylesheet" append-hash="true" class="quarto-color-scheme quarto-color-alternate" id="quarto-bootstrap" data-mode="dark"> 87<link href="../site_libs/bootstrap/bootstrap-e4b02b9d8ec73f0e62ff208b9459ea2c.min.css" rel="stylesheet" append-hash="true" class="quarto-color-scheme-extra" id="quarto-bootstrap" data-mode="light">
88<script id="quarto-search-options" type="application/json">{ 89 "location": "navbar", 90 "copy-button": false, 91 "collapse-after": 3, 92 "panel-placement": "end", 93 "type": "overlay", 94 "limit": 50, 95 "algolia": { 96 "application-id": "TNU9HG3L41", 97 "search-only-api-key": "26350948d1961209df16d9717a7e01d6", 98 "index-name": "prod_ibis", 99 "analytics-events": true, 100 "show-logo": true, 101 "libDir": "site_libs", 102 "cookie-consent-enabled": false 103 }, 104 "keyboard-shortcut": [ 105 "f", 106 "/", 107 "s" 108 ], 109 "language": { 110 "search-no-results-text": "No results", 111 "search-matching-documents-text": "matching documents", 112 "search-copy-link-title": "Copy link to search", 113 "search-hide-matches-text": "Hide additional matches", 114 "search-more-match-text": "more match in this document", 115 "search-more-matches-text": "more matches in this document", 116 "search-clear-button-title": "Clear", 117 "search-text-placeholder": "", 118 "search-detached-cancel-button-title": "Cancel", 119 "search-submit-button-title": "Submit", 120 "search-label": "Search" 121 } 122}</script>
vendor: 1 bytes, line 122
122
123<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/algoliasearch-lite.umd.js"></script>
123 124 125
126<script type="text/javascript"> 127var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights/dist/search-insights.iife.min.js"; 128!function(e,a,t,n,s,i,c){e.AlgoliaAnalyticsObject=s,e[s]=e[s]||function(){ 129(e[s].queue=e[s].queue||[]).push(arguments)},i=a.createElement(t),c=a.getElementsByTagName(t)[0], 130i.async=1,i.src=n,c.parentNode.insertBefore(i,c) 131}(window,document,"script",ALGOLIA_INSIGHTS_SRC,"aa"); 132</script>
132 133
134<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@algolia/autocomplete-plugin-algolia-insights"> 135 136</script>
vendor: 1 bytes, line 136
136
137<script src="https://cdn.jsdelivr.net/npm/[email protected]/require.min.js" integrity="sha384-c9c+LnTbwQ3aujuU7ULEPVvgLs+Fn6fJUvIGTsuu1ZcCf11fiEubah0ttpca4ntM sha384-6V1/AdqZRWk1KAlWbKBlGhN7VG4iE/yAZcO6NZPMF8od0vukrvr0tg4qY6NSrItx" crossorigin="anonymous"></script>
137 138
139<script type="application/javascript">define('jquery', [],function() {return window.jQuery;})</script>
vendor: 1 bytes, line 139
139
140<script data-goatcounter="https://ibis.goatcounter.com/count" async="" src="//gc.zgo.at/count.js"></script>
140 141 142 143<link rel="stylesheet" href="../styles.css"> 144<meta property="og:title" content="10 minutes to Ibis â Ibis"> 145<meta property="og:description" content="the portable Python dataframe library"> 146<meta property="og:image" content="https://ibis-project.org/tutorials/logo.png"> 147<meta property="og:site_name" content="Ibis"> 148<meta name="twitter:title" content="10 minutes to Ibis â Ibis"> 149<meta name="twitter:description" content="the portable Python dataframe library"> 150<meta name="twitter:image" content="https://ibis-project.org/tutorials/logo.png"> 151<meta name="twitter:card" content="summary_large_image"> 152</head> 153 154<body class="nav-sidebar floating nav-fixed quarto-light">
154<script id="quarto-html-before-body" type="application/javascript"> 155 const toggleBodyColorMode = (bsSheetEl) => { 156 const mode = bsSheetEl.getAttribute("data-mode"); 157 const bodyEl = window.document.querySelector("body"); 158 if (mode === "dark") { 159 bodyEl.classList.add("quarto-dark"); 160 bodyEl.classList.remove("quarto-light"); 161 } else { 162 bodyEl.classList.add("quarto-light"); 163 bodyEl.classList.remove("quarto-dark"); 164 } 165 } 166 const toggleBodyColorPrimary = () => { 167 const bsSheetEl = window.document.querySelector("link#quarto-bootstrap:not([rel=disabled-stylesheet])"); 168 if (bsSheetEl) { 169 toggleBodyColorMode(bsSheetEl); 170 } 171 } 172 const setColorSchemeToggle = (alternate) => { 173 const toggles = window.document.querySelectorAll('.quarto-color-scheme-toggle'); 174 for (let i=0; i < toggles.length; i++) { 175 const toggle = toggles[i]; 176 if (toggle) { 177 if (alternate) { 178 toggle.classList.add("alternate"); 179 } else { 180 toggle.classList.remove("alternate"); 181 } 182 } 183 } 184 }; 185 const toggleColorMode = (alternate) => { 186 // Switch the stylesheets 187 const primaryStylesheets = window.document.querySelectorAll('link.quarto-color-scheme:not(.quarto-color-alternate)'); 188 const alternateStylesheets = window.document.querySelectorAll('link.quarto-color-scheme.quarto-color-alternate'); 189 manageTransitions('#quarto-margin-sidebar .nav-link', false); 190 if (alternate) { 191 // note: dark is layered on light, we don't disable primary! 192 enableStylesheet(alternateStylesheets); 193 for (const sheetNode of alternateStylesheets) { 194 if (sheetNode.id === "quarto-bootstrap") { 195 toggleBodyColorMode(sheetNode); 196 } 197 } 198 } else { 199 disableStylesheet(alternateStylesheets); 200 enableStylesheet(primaryStylesheets) 201 toggleBodyColorPrimary(); 202 } 203 manageTransitions('#quarto-margin-sidebar .nav-link', true); 204 // Switch the toggles 205 setColorSchemeToggle(alternate) 206 // Hack to workaround the fact that safari doesn't 207 // properly recolor the scrollbar when toggling (#1455) 208 if (navigator.userAgent.indexOf('Safari') > 0 && navigator.userAgent.indexOf('Chrome') == -1) { 209 manageTransitions("body", false); 210 window.scrollTo(0, 1); 211 setTimeout(() => { 212 window.scrollTo(0, 0); 213 manageTransitions("body", true); 214 }, 40); 215 } 216 } 217 const disableStylesheet = (stylesheets) => { 218 for (let i=0; i < stylesheets.length; i++) { 219 const stylesheet = stylesheets[i]; 220 stylesheet.rel = 'disabled-stylesheet'; 221 } 222 } 223 const enableStylesheet = (stylesheets) => { 224 for (let i=0; i < stylesheets.length; i++) { 225 const stylesheet = stylesheets[i]; 226 if(stylesheet.rel !== 'stylesheet') { // for Chrome, which will still FOUC without this check 227 stylesheet.rel = 'stylesheet'; 228 } 229 } 230 } 231 const manageTransitions = (selector, allowTransitions) => { 232 const els = window.document.querySelectorAll(selector); 233 for (let i=0; i < els.length; i++) { 234 const el = els[i]; 235 if (allowTransitions) { 236 el.classList.remove('notransition'); 237 } else { 238 el.classList.add('notransition'); 239 } 240 } 241 } 242 const isFileUrl = () => { 243 return window.location.protocol === 'file:'; 244 } 245 const hasAlternateSentinel = () => { 246 let styleSentinel = getColorSchemeSentinel(); 247 if (styleSentinel !== null) { 248 return styleSentinel === "alternate"; 249 } else { 250 return false; 251 } 252 } 253 const setStyleSentinel = (alternate) => { 254 const value = alternate ? "alternate" : "default"; 255 if (!isFileUrl()) { 256 window.localStorage.setItem("quarto-color-scheme", value); 257 } else { 258 localAlternateSentinel = value; 259 } 260 } 261 const getColorSchemeSentinel = () => { 262 if (!isFileUrl()) { 263 const storageValue = window.localStorage.getItem("quarto-color-scheme"); 264 return storageValue != null ? storageValue : localAlternateSentinel; 265 } else { 266 return localAlternateSentinel; 267 } 268 } 269 const toggleGiscusIfUsed = (isAlternate, darkModeDefault) => { 270 const baseTheme = document.querySelector('#giscus-base-theme')?.value ?? 'light'; 271 const alternateTheme = document.querySelector('#giscus-alt-theme')?.value ?? 'dark'; 272 let newTheme = ''; 273 if(authorPrefersDark) { 274 newTheme = isAlternate ? baseTheme : alternateTheme; 275 } else { 276 newTheme = isAlternate ? alternateTheme : baseTheme; 277 } 278 const changeGiscusTheme = () => { 279 // From: https://github.com/giscus/giscus/issues/336 280 const sendMessage = (message) => { 281 const iframe = document.querySelector('iframe.giscus-frame'); 282 if (!iframe) return; 283 iframe.contentWindow.postMessage({ giscus: message }, 'https://giscus.app'); 284 } 285 sendMessage({ 286 setConfig: { 287 theme: newTheme 288 } 289 }); 290 } 291 const isGiscussLoaded = window.document.querySelector('iframe.giscus-frame') !== null; 292 if (isGiscussLoaded) { 293 changeGiscusTheme(); 294 } 295 }; 296 const authorPrefersDark = false;
297 const darkModeDefault = authorPrefersDark; 298 document.querySelector('link#quarto-text-highlighting-styles.quarto-color-scheme-extra').rel = 'disabled-stylesheet'; 299 document.querySelector('link#quarto-bootstrap.quarto-color-scheme-extra').rel = 'disabled-stylesheet'; 300 let localAlternateSentinel = darkModeDefault ? 'alternate' : 'default'; 301 // Dark / light mode switch 302 window.quartoToggleColorScheme = () => { 303 // Read the current dark / light value 304 let toAlternate = !hasAlternateSentinel(); 305 toggleColorMode(toAlternate); 306 setStyleSentinel(toAlternate); 307 toggleGiscusIfUsed(toAlternate, darkModeDefault); 308 window.dispatchEvent(new Event('resize')); 309 }; 310 // Switch to dark mode if need be 311 if (hasAlternateSentinel()) { 312 toggleColorMode(true); 313 } else { 314 toggleColorMode(false); 315 } 316 </script>
316 317 318<div id="quarto-search-results"></div> 319 <header id="quarto-header" class="headroom fixed-top"> 320 <nav class="navbar navbar-expand-lg " data-bs-theme="dark"> 321 <div class="navbar-container container-fluid"> 322 <div class="navbar-brand-container mx-auto"> 323 <a class='navbar-brand navbar-brand-logo' href='/'> 324 <img src="../logo.svg" alt="" class="navbar-logo light-content"> 325 <img src="../logo.svg" alt="" class="navbar-logo dark-content"> 326 </a> 327 <a class='navbar-brand' href='/'> 328 <span class="navbar-title">Ibis</span> 329 </a> 330 </div> 331 <div id="quarto-search" class="" title="Search"></div> 332 <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" role="menu" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }"> 333 <span class="navbar-toggler-icon"></span> 334</button> 335 <div class="collapse navbar-collapse" id="navbarCollapse"> 336 <ul class="navbar-nav navbar-nav-scroll me-auto"> 337 <li class="nav-item dropdown "> 338 <a class="nav-link dropdown-toggle" href="#" id="nav-menu-getting-started" role="link" data-bs-toggle="dropdown" aria-expanded="false"> 339 <span class="menu-text">Getting started</span> 340 </a> 341 <ul class="dropdown-menu" aria-labelledby="nav-menu-getting-started"> 342 <li> 343 <a class='dropdown-item' href='/tutorials/basics'> 344 <span class="dropdown-text">10 minutes to Ibis</span></a> 345 </li> 346 <li> 347 <a class='dropdown-item' href='/install'> 348 <span class="dropdown-text">Installation</span></a> 349 </li> 350 <li> 351 <a class='dropdown-item' href='/tutorials/browser/repl'> 352 <span class="dropdown-text">Online playground</span></a> 353 </li> 354 <li><hr class="dropdown-divider"></li> 355 <li class="dropdown-header">Coming from â¦</li> 356 <li> 357 <a class='dropdown-item' href='/tutorials/coming-from/dplyr'> 358 <span class="dropdown-text">dplyr</span></a> 359 </li> 360 <li> 361 <a class='dropdown-item' href='/tutorials/coming-from/pandas'> 362 <span class="dropdown-text">pandas</span></a> 363 </li> 364 <li> 365 <a class='dropdown-item' href='/tutorials/coming-from/sql'> 366 <span class="dropdown-text">SQL</span></a> 367 </li> 368 <li><hr class="dropdown-divider"></li> 369 <li class="dropdown-header">Backend examples</li> 370 <li> 371 <a class='dropdown-item' href='/tutorials/backends/clickhouse'> 372 <span class="dropdown-text">ClickHouse</span></a> 373 </li> 374 <li>
375 <a class='dropdown-item' href='/tutorials/backends/apache-flink/0_setup'> 376 <span class="dropdown-text">Apache Flink</span></a> 377 </li> 378 <li> 379 <a class='dropdown-item' href='/tutorials/backends/starburst-galaxy/0_setup'> 380 <span class="dropdown-text">Starburst Galaxy</span></a> 381 </li> 382 </ul> 383 </li> 384 <li class="nav-item dropdown "> 385 <a class="nav-link dropdown-toggle" href="#" id="nav-menu-concepts" role="link" data-bs-toggle="dropdown" aria-expanded="false"> 386 <span class="menu-text">Concepts</span> 387 </a> 388 <ul class="dropdown-menu" aria-labelledby="nav-menu-concepts"> 389 <li> 390 <a class='dropdown-item' href='/why'> 391 <span class="dropdown-text">Why Ibis?</span></a> 392 </li> 393 <li> 394 <a class='dropdown-item' href='/concepts/backend-table-hierarchy'> 395 <span class="dropdown-text">Backend Table Hierarchy</span></a> 396 </li> 397 <li> 398 <a class='dropdown-item' href='/concepts/casting'> 399 <span class="dropdown-text">Casting between datatypes</span></a> 400 </li> 401 <li> 402 <a class='dropdown-item' href='/concepts/composable-ecosystem'> 403 <span class="dropdown-text">Composable data ecosystem</span></a> 404 </li> 405 <li> 406 <a class='dropdown-item' href='/concepts/datatypes'> 407 <span class="dropdown-text">Datatypes and Datashapes</span></a> 408 </li> 409 <li> 410 <a class='dropdown-item' href='/concepts/internals'> 411 <span class="dropdown-text">Internals</span></a> 412 </li> 413 <li> 414 <a class='dropdown-item' href='/concepts/user-testimonials'> 415 <span class="dropdown-text">User testimonials</span></a> 416 </li> 417 <li> 418 <a class='dropdown-item' href='/concepts/versioning'> 419 <span class="dropdown-text">Versioning policy</span></a> 420 </li> 421 <li> 422 <a class='dropdown-item' href='/concepts/who'> 423 <span class="dropdown-text">Who supports Ibis?</span></a> 424 </li> 425 </ul> 426 </li> 427 <li class="nav-item dropdown "> 428 <a class="nav-link dropdown-toggle" href="#" id="nav-menu-backends" role="link" data-bs-toggle="dropdown" aria-expanded="false"> 429 <span class="menu-text">Backends</span> 430 </a> 431 <ul class="dropdown-menu" aria-labelledby="nav-menu-backends"> 432 <li> 433 <a class='dropdown-item' href='/backends/athena'> 434 <span class="dropdown-text">Amazon Athena</span></a> 435 </li> 436 <li> 437 <a class='dropdown-item' href='/backends/bigquery'> 438 <span class="dropdown-text">BigQuery</span></a> 439 </li> 440 <li> 441 <a class='dropdown-item' href='/backends/clickhouse'> 442 <span class="dropdown-text">ClickHouse</span></a> 443 </li> 444 <li> 445 <a class='dropdown-item' href='/backends/dask'> 446 <span class="dropdown-text">Dask</span></a> 447 </li> 448 <li> 449 <a class='dropdown-item' href='/backends/databricks'> 450 <span class="dropdown-text">Databricks</span></a> 451 </li> 452 <li> 453 <a class='dropdown-item' href='/backends/datafusion'> 454 <span class="dropdown-text">DataFusion</span></a> 455 </li> 456 <li> 457 <a class='dropdown-item' href='/backends/druid'> 458 <span class="dropdown-text">Druid</span></a> 459 </li> 460 <li> 461 <a class='dropdown-item' href='/backends/duckdb'> 462 <span class="dropdown-text">DuckDB</span></a> 463 </li> 464 <li> 465 <a class='dropdown-item' href='/backends/exasol'> 466 <span class="dropdown-text">Exasol</span></a> 467 </li> 468 <li> 469 <a class='dropdown-item' href='/backends/flink'> 470 <span class="dropdown-text">Flink</span></a> 471 </li> 472 <li> 473 <a class='dropdown-item' href='/backends/impala'> 474 <span class="dropdown-text">Impala</span></a> 475 </li> 476 <li> 477 <a class='dropdown-item' href='/backends/materialize'> 478 <span class="dropdown-text">Materialize</span></a> 479 </li> 480 <li> 481 <a class='dropdown-item' href='/backends/mssql'> 482 <span class="dropdown-text">MSSQL</span></a> 483 </li> 484 <li> 485 <a class='dropdown-item' href='/backends/mysql'> 486 <span class="dropdown-text">MySQL</span></a> 487 </li> 488 <li> 489 <a class='dropdown-item' href='/backends/oracle'> 490 <span class="dropdown-text">Oracle</span></a> 491 </li> 492 <li> 493 <a class='dropdown-item' href='/backends/pandas'> 494 <span class="dropdown-text">pandas</span></a> 495 </li> 496 <li> 497 <a class='dropdown-item' href='/backends/polars'> 498 <span class="dropdown-text">Polars</span></a> 499 </li> 500 <li> 501 <a class='dropdown-item' href='/backends/postgresql'> 502 <span class="dropdown-text">PostgreSQL</span></a> 503 </li> 504 <li> 505 <a class='dropdown-item' href='/backends/pyspark'> 506 <span class="dropdown-text">PySpark</span></a> 507 </li> 508 <li> 509 <a class='dropdown-item' href='/backends/risingwave'> 510 <span class="dropdown-text">RisingWave</span></a> 511 </li> 512 <li> 513 <a class='dropdown-item' href='/backends/singlestoredb'> 514 <span class="dropdown-text">SingleStoreDB</span></a> 515 </li> 516 <li> 517 <a class='dropdown-item' href='/backends/snowflake'> 518 <span class="dropdown-text">Snowflake</span></a> 519 </li> 520 <li> 521 <a class='dropdown-item' href='/backends/sqlite'> 522 <span class="dropdown-text">SQLite</span></a> 523 </li> 524 <li> 525 <a class='dropdown-item' href='/backends/trino'> 526 <span class="dropdown-text">Trino</span></a> 527 </li> 528 <li><hr class="dropdown-divider"></li> 529 <li class="dropdown-header">Support</li> 530 <li> 531 <a class='dropdown-item' href='/backends/support/cloud_support_policy'> 532 <span class="dropdown-text">Cloud backend support policy</span></a> 533 </li> 534 <li> 535 <a class='dropdown-item' href='/backends/support/matrix'> 536 <span class="dropdown-text">Operation support matrix</span></a> 537 </li> 538 <li> 539 <a class='dropdown-item' href='/reference/operations'> 540 <span class="dropdown-text">Operations</span></a> 541 </li> 542 </ul> 543 </li> 544 <li class="nav-item dropdown "> 545 <a class="nav-link dropdown-toggle" href="#" id="nav-menu-how-to" role="link" data-bs-toggle="dropdown" aria-expanded="false"> 546 <span class="menu-text">How-to</span> 547 </a> 548 <ul class="dropdown-menu" aria-labelledby="nav-menu-how-to"> 549 <li class="dropdown-header">Configure</li> 550 <li> 551 <a class='dropdown-item' href='/how-to/configure/basics'> 552 <span class="dropdown-text">Basic configuration</span></a> 553 </li> 554 <li><hr class="dropdown-divider"></li> 555 <li class="dropdown-header">Input Output</li> 556 <li> 557 <a class='dropdown-item' href='/how-to/input-output/basics'> 558 <span class="dropdown-text">Basic input/output</span></a> 559 </li> 560 <li> 561 <a class='dropdown-item' href='/how-to/input-output/duckdb-parquet'> 562 <span class="dropdown-text">Read parquet files with Ibis</span></a> 563 </li> 564 <li> 565 <a class='dropdown-item' href='/how-to/input-output/gcs_duckdb'> 566 <span class="dropdown-text">Loading Google Cloud Storage files with DuckDB</span></a> 567 </li> 568 <li> 569 <a class='dropdown-item' href='/how-to/input-output/multiple-backends'> 570 <span class="dropdown-text">Work with multiple backends</span></a> 571 </li> 572 <li><hr class="dropdown-divider"></li> 573 <li class="dropdown-header">Analytics</li> 574 <li> 575 <a class='dropdown-item' href='/how-to/analytics/basics'> 576 <span class="dropdown-text">Basic analytics</span></a> 577 </li> 578 <li> 579 <a class='dropdown-item' href='/how-to/analytics/chain_expressions'> 580 <span class="dropdown-text">Chaining expressions</span></a> 581 </li> 582 <li> 583 <a class='dropdown-item' href='/how-to/analytics/imdb'> 584 <span class="dropdown-text">Analyze IMDB data using Ibis</span></a> 585 </li> 586 <li><hr class="dropdown-divider"></li> 587 <li class="dropdown-header">Visualization</li> 588 <li> 589 <a class='dropdown-item' href='/how-to/visualization/altair'> 590 <span class="dropdown-text">Altair + Ibis</span></a> 591 </li> 592 <li> 593 <a class='dropdown-item' href='/how-to/visualization/graphs'> 594 <span class="dropdown-text">GraphViz + Ibis</span></a> 595 </li> 596 <li> 597 <a class='dropdown-item' href='/how-to/visualization/marimo'> 598 <span class="dropdown-text">marimo + Ibis</span></a> 599 </li> 600 <li> 601 <a class='dropdown-item' href='/how-to/visualization/matplotlib'> 602 <span class="dropdown-text">matplotlib + Ibis</span></a> 603 </li> 604 <li> 605 <a class='dropdown-item' href='/how-to/visualization/plotly'> 606 <span class="dropdown-text">Plotly + Ibis</span></a> 607 </li> 608 <li> 609 <a class='dropdown-item' href='/how-to/visualization/plotnine'> 610 <span class="dropdown-text">plotnine + Ibis</span></a> 611 </li> 612 <li> 613 <a class='dropdown-item' href='/how-to/visualization/seaborn'> 614 <span class="dropdown-text">seaborn + Ibis</span></a> 615 </li> 616 <li> 617 <a class='dropdown-item' href='/how-to/visualization/streamlit'> 618 <span class="dropdown-text">Streamlit + Ibis</span></a> 619 </li> 620 <li><hr class="dropdown-divider"></li> 621 <li class="dropdown-header">Extending</li> 622 <li> 623 <a class='dropdown-item' href='/how-to/extending/builtin'> 624 <span class="dropdown-text">Reference built-in functions</span></a> 625 </li> 626 <li> 627 <a class='dropdown-item' href='/how-to/extending/sql'> 628 <span class="dropdown-text">Using SQL strings with Ibis</span></a> 629 </li> 630 <li> 631 <a class='dropdown-item' href='/how-to/extending/streaming'> 632 <span class="dropdown-text">Ibis for streaming</span></a> 633 </li> 634 <li> 635 <a class='dropdown-item' href='/how-to/extending/unbound_expression'> 636 <span class="dropdown-text">Write and execute unbound expressions</span></a> 637 </li> 638 </ul> 639 </li> 640 <li class="nav-item dropdown "> 641 <a class="nav-link dropdown-toggle" href="#" id="nav-menu-reference" role="link" data-bs-toggle="dropdown" aria-expanded="false"> 642 <span class="menu-text">Reference</span> 643 </a> 644 <ul class="dropdown-menu" aria-labelledby="nav-menu-reference"> 645 <li class="dropdown-header">Expression API</li> 646 <li> 647 <a class='dropdown-item' href='/reference/expression-tables'> 648 <span class="dropdown-text">Table expressions</span></a> 649 </li> 650 <li> 651 <a class='dropdown-item' href='/reference/selectors'> 652 <span class="dropdown-text">Column selectors</span></a> 653 </li> 654 <li> 655 <a class='dropdown-item' href='/reference/expression-generic'> 656 <span class="dropdown-text">Generic expressions</span></a> 657 </li> 658 <li> 659 <a class='dropdown-item' href='/reference/expression-numeric'> 660 <span class="dropdown-text">Numeric and Boolean expressions</span></a> 661 </li> 662 <li> 663 <a class='dropdown-item' href='/reference/expression-strings'> 664 <span class="dropdown-text">String expressions</span></a> 665 </li> 666 <li> 667 <a class='dropdown-item' href='/reference/expression-temporal'> 668 <span class="dropdown-text">Temporal expressions</span></a> 669 </li> 670 <li> 671 <a class='dropdown-item' href='/reference/expression-collections'> 672 <span class="dropdown-text">Collection expressions</span></a> 673 </li> 674 <li> 675 <a class='dropdown-item' href='/reference/expression-json'> 676 <span class="dropdown-text">JSON expressions</span></a> 677 </li> 678 <li> 679 <a class='dropdown-item' href='/reference/expression-geospatial'> 680 <span class="dropdown-text">Geospatial expressions</span></a> 681 </li> 682 <li> 683 <a class='dropdown-item' href='/reference/expression-misc'> 684 <span class="dropdown-text">UUIDs, INET, MACADDR expressions</span></a> 685 </li> 686 <li><hr class="dropdown-divider"></li> 687 <li class="dropdown-header">Type system</li> 688 <li> 689 <a class='dropdown-item' href='/reference/datatypes'> 690 <span class="dropdown-text">Data types</span></a> 691 </li> 692 <li> 693 <a class='dropdown-item' href='/reference/schemas'> 694 <span class="dropdown-text">Schemas</span></a> 695 </li> 696 <li><hr class="dropdown-divider"></li> 697 <li class="dropdown-header">UDFs</li> 698 <li> 699 <a class='dropdown-item' href='/reference/scalar-udfs'> 700 <span class="dropdown-text">Scalar UDFs</span></a> 701 </li> 702 <li> 703 <a class='dropdown-item' href='/reference/aggregate-udfs'> 704 <span class="dropdown-text">Aggregate UDFs (experimental)</span></a> 705 </li> 706 <li><hr class="dropdown-divider"></li> 707 <li class="dropdown-header">Connection APIs</li> 708 <li> 709 <a class='dropdown-item' href='/reference/connection'> 710 <span class="dropdown-text">Top-level connection APIs</span></a> 711 </li> 712 <li><hr class="dropdown-divider"></li> 713 <li class="dropdown-header">Configuration</li> 714 <li> 715 <a class='dropdown-item' href='/reference/interactive'> 716 <span class="dropdown-text">Interactive</span></a> 717 </li> 718 <li> 719 <a class='dropdown-item' href='/reference/options'> 720 <span class="dropdown-text">Options</span></a> 721 </li> 722 <li> 723 <a class='dropdown-item' href='/reference/repr'> 724 <span class="dropdown-text">
724Repr</span></a> 725 </li> 726 <li> 727 <a class='dropdown-item' href='/reference/sql'> 728 <span class="dropdown-text">SQL</span></a> 729 </li> 730 <li><hr class="dropdown-divider"></li> 731 <li class="dropdown-header">Cursed Knowledge</li> 732 <li> 733 <a class='dropdown-item' href='/reference/cursed_knowledge'> 734 <span class="dropdown-text">Cursed Knowledge</span></a> 735 </li> 736 </ul> 737 </li> 738</ul> 739 <ul class="navbar-nav navbar-nav-scroll ms-auto"> 740 <li class="nav-item"> 741 <a class='nav-link' href='/posts'> 742<span class="menu-text">Posts</span></a> 743 </li> 744 <li class="nav-item"> 745 <a class='nav-link' href='/presentations'> 746<span class="menu-text">Presentations</span></a> 747 </li> 748 <li class="nav-item"> 749 <a class='nav-link' href='/release_notes'> 750<span class="menu-text">Release notes</span></a> 751 </li> 752 <li class="nav-item dropdown "> 753 <a class="nav-link dropdown-toggle" href="#" id="nav-menu-contribute" role="link" data-bs-toggle="dropdown" aria-expanded="false"> 754 <span class="menu-text">Contribute</span> 755 </a> 756 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="nav-menu-contribute"> 757 <li class="dropdown-header">Contribute</li> 758 <li> 759 <a class='dropdown-item' href='/contribute/01_environment'> 760 <span class="dropdown-text">Setting up a development environment</span></a> 761 </li> 762 <li> 763 <a class='dropdown-item' href='/contribute/02_workflow'> 764 <span class="dropdown-text">Contribute to the Ibis codebase</span></a> 765 </li> 766 <li> 767 <a class='dropdown-item' href='/contribute/03_style'> 768 <span class="dropdown-text">Style and formatting</span></a> 769 </li> 770 <li> 771 <a class='dropdown-item' href='/contribute/04_maintainers_guide'> 772 <span class="dropdown-text">Maintaining the codebase</span></a> 773 </li> 774 <li> 775 <a class='dropdown-item' href='/contribute/05_reference'> 776 <span class="dropdown-text">Test class reference</span></a> 777 </li> 778 <li> 779 <a class='dropdown-item' href='/contribute/06_automated_code_and_ai'> 780 <span class="dropdown-text">Automated Code and AI</span></a> 781 </li> 782 </ul> 783 </li> 784</ul> 785 </div> <!-- /navcollapse --> 786 <div class="quarto-navbar-tools"> 787 <div class="dropdown"> 788 <a href="" title="" id="quarto-navigation-tool-dropdown-0" class="quarto-navigation-tool dropdown-toggle px-1" data-bs-toggle="dropdown" aria-expanded="false" role="link" aria-label=""><i class="bi bi-github"></i></a> 789 <ul class="dropdown-menu" aria-labelledby="quarto-navigation-tool-dropdown-0"> 790 <li> 791 <a class="dropdown-item quarto-navbar-tools-item" href="https://github.com/ibis-project/ibis"> 792 Source code 793 </a> 794 </li> 795 <li> 796 <a class="dropdown-item quarto-navbar-tools-item" href="https://github.com/ibis-project/ibis/issues/new?assignees=&labels=bug&projects=&template=bug-report.yml&title=bug"> 797 Report a bug 798 </a> 799 </li> 800 <li> 801 <a class="dropdown-item quarto-navbar-tools-item" href="https://github.com/ibis-project/ibis/issues/new?assignees=&labels=docs&projects=&template=docs-issue.yml&title=docs"> 802 Report a documentation issue 803 </a> 804 </li> 805 <li> 806 <a class="dropdown-item quarto-navbar-tools-item" href="https://github.com/ibis-project/ibis/issues/new?assignees=&labels=feature&projects=&template=feature-request.yml&title=feat"> 807 Submit a feature request 808 </a> 809 </li> 810 <li> 811 <a class="dropdown-item quarto-navbar-tools-item" href="https://github.com/ibis-project/ibis/discussions/new?category=q-a"> 812 Ask the community for help 813 </a> 814 </li> 815 </ul> 816 </div> 817 <a href="" class="quarto-color-scheme-toggle quarto-navigation-tool px-1" onclick="window.quartoToggleColorScheme(); return false;" title="Toggle dark mode"><i class="bi"></i></a> 818</div> 819 </div> <!-- /container-fluid --> 820 </nav> 821 <nav class="quarto-secondary-nav"> 822 <div class="container-fluid d-flex"> 823 <button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" role="button" data-bs-target=".quarto-sidebar-collapse-item" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }"> 824 <i class="bi bi-layout-text-sidebar-reverse"></i> 825 </button> 826 <nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href='/tutorials/basics'>10 minutes to Ibis</a></li></ol></nav> 827 <a class="flex-grow-1" role="navigation" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }"> 828 </a> 829 </div> 830 </nav> 831</header> 832<!-- content -->
833<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar"> 834<!-- sidebar --> 835 <nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto"> 836 <div class="sidebar-menu-container"> 837 <ul class="list-unstyled mt-1"> 838 <li class="sidebar-item"> 839 <div class="sidebar-item-container"> 840 <a class='sidebar-item-text sidebar-link active' href='/tutorials/basics'> 841 <span class="menu-text">10 minutes to Ibis</span></a> 842 </div> 843</li> 844 <li class="sidebar-item"> 845 <div class="sidebar-item-container"> 846 <a class='sidebar-item-text sidebar-link' href='/install'> 847 <span class="menu-text">Installation</span></a> 848 </div> 849</li> 850 <li class="sidebar-item"> 851 <div class="sidebar-item-container"> 852 <a class='sidebar-item-text sidebar-link' href='/tutorials/browser/repl'> 853 <span class="menu-text">Online playground</span></a> 854 </div> 855</li> 856 <li class="sidebar-item sidebar-item-section"> 857 <div class="sidebar-item-container"> 858 <a class="sidebar-item-text sidebar-link text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" role="navigation" aria-expanded="true"> 859 <span class="menu-text">Coming from â¦</span></a> 860 <a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" role="navigation" aria-expanded="true" aria-label="Toggle section"> 861 <i class="bi bi-chevron-right ms-2"></i> 862 </a> 863 </div> 864 <ul id="quarto-sidebar-section-1" class="collapse list-unstyled sidebar-section depth1 show"> 865 <li class="sidebar-item"> 866 <div class="sidebar-item-container"> 867 <a class='sidebar-item-text sidebar-link' href='/tutorials/coming-from/dplyr'> 868 <span class="menu-text">dplyr</span></a> 869 </div> 870</li> 871 <li class="sidebar-item"> 872 <div class="sidebar-item-container"> 873 <a class='sidebar-item-text sidebar-link' href='/tutorials/coming-from/pandas'> 874 <span class="menu-text">pandas</span></a> 875 </div> 876</li> 877 <li class="sidebar-item"> 878 <div class="sidebar-item-container"> 879 <a class='sidebar-item-text sidebar-link' href='/tutorials/coming-from/sql'> 880 <span class="menu-text">SQL</span></a> 881 </div> 882</li> 883 </ul> 884 </li> 885 <li class="sidebar-item sidebar-item-section"> 886 <div class="sidebar-item-container"> 887 <a class="sidebar-item-text sidebar-link text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-2" role="navigation" aria-expanded="true"> 888 <span class="menu-text">Backend examples</span></a> 889 <a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-2" role="navigation" aria-expanded="true" aria-label="Toggle section"> 890 <i class="bi bi-chevron-right ms-2"></i> 891 </a> 892 </div> 893 <ul id="quarto-sidebar-section-2" class="collapse list-unstyled sidebar-section depth1 show"> 894 <li class="sidebar-item"> 895 <div class="sidebar-item-container"> 896 <a class='sidebar-item-text sidebar-link' href='/tutorials/backends/clickhouse'> 897 <span class="menu-text">ClickHouse</span></a> 898 </div> 899</li> 900 <li class="sidebar-item sidebar-item-section"> 901 <div class="sidebar-item-container"> 902 <a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-3" role="navigation" aria-expanded="false"> 903 <span class="menu-text">Apache Flink</span></a> 904 <a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-3" role="navigation" aria-expanded="false" aria-label="Toggle section"> 905 <i class="bi bi-chevron-right ms-2"></i> 906 </a> 907 </div> 908 <ul id="quarto-sidebar-section-3" class="collapse list-unstyled sidebar-section depth2 "> 909 <li class="sidebar-item"> 910 <div class="sidebar-item-container"> 911 <a class='sidebar-item-text sidebar-link' href='/tutorials/backends/apac
911he-flink/0_setup'> 912 <span class="menu-text">Getting started</span></a> 913 </div> 914</li> 915 <li class="sidebar-item"> 916 <div class="sidebar-item-container"> 917 <a class='sidebar-item-text sidebar-link' href='/tutorials/backends/apache-flink/1_single_feature'> 918 <span class="menu-text">A real-life use case: fraud detection</span></a> 919 </div> 920</li> 921 </ul> 922 </li> 923 <li class="sidebar-item sidebar-item-section"> 924 <div class="sidebar-item-container"> 925 <a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-4" role="navigation" aria-expanded="false"> 926 <span class="menu-text">Starburst Galaxy</span></a> 927 <a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-4" role="navigation" aria-expanded="false" aria-label="Toggle section"> 928 <i class="bi bi-chevron-right ms-2"></i> 929 </a> 930 </div> 931 <ul id="quarto-sidebar-section-4" class="collapse list-unstyled sidebar-section depth2 "> 932 <li class="sidebar-item"> 933 <div class="sidebar-item-container"> 934 <a class='sidebar-item-text sidebar-link' href='/tutorials/backends/starburst-galaxy/0_setup'> 935 <span class="menu-text">Requirements and setup</span></a> 936 </div> 937</li> 938 <li class="sidebar-item"> 939 <div class="sidebar-item-container"> 940 <a class='sidebar-item-text sidebar-link' href='/tutorials/backends/starburst-galaxy/1_basics'> 941 <span class="menu-text">Basic operations</span></a> 942 </div> 943</li> 944 </ul> 945 </li> 946 </ul> 947 </li> 948 </ul> 949 </div> 950</nav> 951<div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div> 952<!-- margin-sidebar --> 953 <div id="quarto-margin-sidebar" class="sidebar margin-sidebar"> 954 <nav id="TOC" role="doc-toc" class="toc-active"> 955 <h2 id="toc-title">On this page</h2> 956 957 <ul> 958 <li><a href="#install-ibis" id="toc-install-ibis" class="nav-link active" data-scroll-target="#install-ibis">Install Ibis</a></li> 959 <li><a href="#create-a-database-file" id="toc-create-a-database-file" class="nav-link" data-scroll-target="#create-a-database-file">Create a database file</a></li> 960 <li><a href="#interactive-mode" id="toc-interactive-mode" class="nav-link" data-scroll-target="#interactive-mode">Interactive mode</a></li> 961 <li><a href="#common-operations" id="toc-common-operations" class="nav-link" data-scroll-target="#common-operations">Common operations</a> 962 <ul class="collapse"> 963 <li><a href="#filter" id="toc-filter" class="nav-link" data-scroll-target="#filter">filter</a></li> 964 <li><a href="#select" id="toc-select" class="nav-link" data-scroll-target="#select">select</a></li> 965 <li><a href="#mutate" id="toc-mutate" class="nav-link" data-scroll-target="#mutate">mutate</a></li> 966 <li><a href="#selectors" id="toc-selectors" class="nav-link" data-scroll-target="#selectors">selectors</a></li> 967 <li><a href="#order_by" id="toc-order_by" class="nav-link" data-scroll-target="#order_by">order_by</a></li> 968 <li><a href="#aggregates" id="toc-aggregates" class="nav-link" data-scroll-target="#aggregates">aggregates</a></li> 969 <li><a href="#group_by" id="toc-group_by" class="nav-link" data-scroll-target="#group_by">group_by</a></li> 970 </ul></li> 971 <li><a href="#chaining-it-all-together" id="toc-chaining-it-all-together" class="nav-link" data-scroll-target="#chaining-it-all-together">Chaining it all together</a></li> 972 <li><a href="#learn-more" id="toc-learn-more" class="nav-link" data-scroll-target="#learn-more">Learn more</a></li> 973 </ul> 974<div class="toc-actions"><ul><li><a href="https://github.com/ibis-project/ibis/edit/main/docs/tutorials/basics.qmd" class="toc-action"><i class="bi bi-github"></i>Edit this page</a></li><li><a href="https://github.com/ibis-project/ibis/issues/new/choose" class="toc-action"><i class="bi empty"></i>Report an issue</a></li></ul></div></nav> 975 </div> 976<!-- main --> 977<main class="content" id="quarto-document-content"> 978 979 980<header id="title-block-header" class="quarto-title-block default"> 981<div class="quarto-title"> 982<h1 class="title">10 minutes to Ibis</h1> 983</div> 984 985 986 987<div class="quarto-title-meta"> 988 989 990 991 992 </div> 993 994 995 996</header> 997 998 999<p>This is a quick tour of some basic commands and usage patterns, just to get your flippers wet.</p> 1000<div class="callout callout-style-default callout-tip callout-titled"> 1001<div class="callout-header d-flex align-content-center"> 1002<div class="callout-icon-container"> 1003<i class="callout-icon"></i> 1004</div> 1005<div class="callout-title-container flex-fill"> 1006Tip 1007</div> 1008</div> 1009<div class="callout-body-container callout-body"> 1010<p>You can run this tutorial in a GitHub Codespace with everything setup for you:</p> 1011<p><a href="https://codespaces.new/ibis-project/ibis"><img src="https://github.com/codespaces/badge.svg" class="img-fluid"></a></p> 1012</div> 1013</div> 1014<section id="install-ibis" class="level2"> 1015<h2 class="anchored" data-anchor-id="install-ibis">Install Ibis</h2> 1016<p>We recommend starting with the default (DuckDB) backend for a performant, fully-featured local experience. You can install Ibis with <code>pip</code>, <code>conda</code>, <code>mamba</code>, or <code>pixi</code>.</p> 1017<div class="tabset-margin-container"></div><div class="panel-tabset"> 1018<ul class="nav nav-tabs" role="tablist"><li class="nav-item" role="presentation"><a class="nav-link active" id="tabset-1-1-tab" data-bs-toggle="tab" data-bs-target="#tabset-1-1" role="tab" aria-controls="tabset-1-1" aria-selected="true" href="">Using <code>pip</code></a></li><li class="nav-item" role="presentation"><a class="nav-link" id="tabset-1-2-tab" data-bs-toggle="tab" data-bs-target="#tabset-1-2" role="tab" aria-controls="tabset-1-2" aria-selected="false" href="">Using <code>conda</code></a></li><li class="nav-item" role="presentation"><a class="nav-link" id="tabset-1-3-tab" data-bs-toggle="tab" data-bs-target="#tabset-1-3" role="tab" aria-controls="tabset-1-3" aria-selected="false" href="">Using <code>mamba</code></a></li><li class="nav-item" role="presentation"><a class="nav-link" id="tabset-1-4-tab" data-bs-toggle="tab" data-bs-target="#tabset-1-4" role="tab" aria-controls="tabset-1-4" aria-selected="false" href="">Using <code>pixi</code></a></li></ul> 1019<div class="tab-content"> 1020<div id="tabset-1-1" class="tab-pane active" role="tabpanel" aria-labelledby="tabset-1-1-tab"> 1021<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="ex">pip</span> install <span class="st">'ibis-framework[duckdb,examples]'</span></span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1022<div class="callout callout-style-default callout-warning callout-titled"> 1023<div class="callout-header d-flex align-content-center"> 1024<div class="callout-icon-container"> 1025<i class="callout-icon"></i> 1026</div> 1027<div class="callout-title-container flex-fill"> 1028Warning 1029</div> 1030</div> 1031<div class="callout-body-container callout-body"> 1032<p>Note that the <code>ibis-framework</code> package is <em>not</em> the same as the <code>ibis</code> package in PyPI. These two libraries cannot coexist in the same Python environment, as they are both imported with the <code>ibis</code> module name.</p> 1033</div> 1034</div> 1035</div> 1036<div id="tabset-1-2" class="tab-pane" role="tabpanel" aria-labelledby="tabset-1-2-tab"> 1037<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">conda</span> install <span class="at">-c</span> conda-forge ibis-duckdb</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1038</div> 1039<div id="tabset-1-3" class="tab-pane" role="tabpanel" aria-labelledby="tabset-1-3-tab"> 1040<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">mamba</span> install <span class="at">-c</span> conda-forge ibis-duckdb</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1041</div> 1042<div id="tabset-1-4" class="tab-pane" role="tabpanel" aria-labelledby="tabset-1-4-tab"> 1043<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">pixi</span> add ibis-duckdb</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1044</div> 1045</div> 1046</div> 1047</section> 1048<section id="create-a-database-file" class="level2"> 1049<h2 class="anchored" data-anchor-id="create-a-database-file">Create a database file</h2> 1050<p>Ibis can work with several file types, but at its core it connects to existing databases and interacts with the data there. Weâll analyze the <em>Palmer penguins</em> <a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a> dataset with <a href="https://duckdb.org">DuckDB</a> to get the hang of this.</p> 1051<div id="f8cbedb0" class="cell" data-execution_count="1"> 1052<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb5"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="im">
1052import</span> ibis</span> 1053<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a></span> 1054<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a>con <span class="op">=</span> ibis.<span class="ex">connect</span>(<span class="st">"duckdb://penguins.ddb"</span>)</span> 1055<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a>con.create_table(</span> 1056<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> <span class="st">"penguins"</span>, ibis.examples.penguins.fetch().to_pyarrow(), overwrite<span class="op">=</span><span class="va">True</span></span> 1057<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a>)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1058<div class="cell-output cell-output-display" data-execution_count="1"> 1059<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">DatabaseTable: penguins.main.penguins 1060 species string 1061 island string 1062 bill_length_mm float64 1063 bill_depth_mm float64 1064 flipper_length_mm int64 1065 body_mass_g int64 1066 sex string 1067 year int64 1068</pre> 1069</div> 1070</div> 1071<p>You can now see the example dataset copied over to the database:</p> 1072<div id="5e0f94f1" class="cell" data-execution_count="2"> 1073<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb6"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>con.list_tables()</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1074<div class="cell-output cell-output-display" data-execution_count="2"> 1075<pre><code>['penguins']</code></pre> 1076</div> 1077</div> 1078<p>Thereâs one table, called <code>penguins</code>. We can ask Ibis to give us an object that we can interact with.</p> 1079<div id="bd9b93fe" class="cell" data-execution_count="3"> 1080<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb8"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a>penguins <span class="op">=</span> con.table(<span class="st">"penguins"</span>)</span> 1081<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a>penguins</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1082<div class="cell-output cell-output-display" data-execution_count="3"> 1083<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">DatabaseTable: penguins 1084 species string 1085 island string 1086 bill_length_mm float64 1087 bill_depth_mm float64 1088 flipper_length_mm int64 1089 body_mass_g int64 1090 sex string 1091 year int64 1092</pre> 1093</div> 1094</div> 1095<p>Ibis is lazily evaluated, so instead of seeing the data, we see the schema of the table, instead. To peek at the data, we can call <code>head</code> and then <code>to_pandas</code> to get the first few rows of the table as a pandas DataFrame.</p> 1096<div id="7c0b2eb6" class="cell" data-execution_count="4"> 1097<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb9"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a>penguins.head().to_pandas()</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1098<div class="cell-output cell-output-display" data-execution_count="4"> 1099<div> 1100 1101 1102<table class="dataframe caption-top table table-sm table-striped small" data-border="1"> 1103<thead> 1104<tr class="header"> 1105<th data-quarto-table-cell-role="th"></th> 1106<th data-quarto-table-cell-role="th">species</th> 1107<th data-quarto-table-cell-role="th">island</th> 1108<th data-quarto-table-cell-role="th">bill_length_mm</th> 1109<th data-quarto-table-cell-role="th">bill_depth_mm</th> 1110<th data-quarto-table-cell-role="th">flipper_length_mm</th> 1111<th data-quarto-table-cell-role="th">body_mass_g</th> 1112<th data-quarto-table-cell-role="th">sex</th> 1113<th data-quarto-table-cell-role="th">year</th> 1114</tr> 1115</thead> 1116<tbody> 1117<tr class="odd"> 1118<th data-quarto-table-cell-role="th">0</th> 1119<td>Adelie</td> 1120<td>Torgersen</td> 1121<td>39.1</td> 1122<td>18.7</td> 1123<td>181.0</td> 1124<td>3750.0</td> 1125<td>male</td> 1126<td>2007</td> 1127</tr> 1128<tr class="even"> 1129<th data-quarto-table-cell-role="th">1</th> 1130<td>Adelie</td> 1131<td>Torgersen</td> 1132<td>39.5</td> 1133<td>17.4</td> 1134<td>186.0</td> 1135<td>3800.0</td> 1136<td>female</td> 1137<td>2007</td> 1138</tr> 1139<tr class="odd"> 1140<th data-quarto-table-cell-role="th">2</th> 1141<td>Adelie</td> 1142<td>Torgersen</td> 1143<td>40.3</td> 1144<td>18.0</td> 1145<td>195.0</td> 1146<td>3250.0</td> 1147<td>female</td> 1148<td>2007</td> 1149</tr> 1150<tr class="even"> 1151<th data-quarto-table-cell-role="th">3</th> 1152<td>Adelie</td> 1153<td>Torgersen</td> 1154<td>NaN</td> 1155<td>NaN</td> 1156<td>NaN</td> 1157<td>NaN</td> 1158<td>None</td> 1159<td>2007</td> 1160</tr> 1161<tr class="odd"> 1162<th data-quarto-table-cell-role="th">4</th> 1163<td>Adelie</td> 1164<td>Torgersen</td> 1165<td>36.7</td> 1166<td>
116619.3</td> 1167<td>193.0</td> 1168<td>3450.0</td> 1169<td>female</td> 1170<td>2007</td> 1171</tr> 1172</tbody> 1173</table> 1174 1175</div> 1176</div> 1177</div> 1178<p><code>to_pandas</code> 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 <code>to_pandas</code> will evaluate (when youâre ready!).</p> 1179<div id="95945b51" class="cell" data-execution_count="5"> 1180<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb10"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a>penguins.head()</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1181<div class="cell-output cell-output-display" data-execution_count="5"> 1182<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">r0 := DatabaseTable: penguins 1183 species string 1184 island string 1185 bill_length_mm float64 1186 bill_depth_mm float64 1187 flipper_length_mm int64 1188 body_mass_g int64 1189 sex string 1190 year int64 1191 1192Limit[r0, n=5] 1193</pre> 1194</div> 1195</div> 1196<div class="callout callout-style-default callout-note callout-titled"> 1197<div class="callout-header d-flex align-content-center"> 1198<div class="callout-icon-container"> 1199<i class="callout-icon"></i> 1200</div> 1201<div class="callout-title-container flex-fill"> 1202Note 1203</div> 1204</div> 1205<div class="callout-body-container callout-body"> 1206<p>Ibis returns results as a pandas DataFrame using <code>to_pandas</code>, but isnât using pandas to perform any of the computation. The query is executed by the backend (DuckDB in this case). Only when <code>to_pandas</code> is called does Ibis then pull back the results and convert them into a DataFrame.</p> 1207</div> 1208</div> 1209</section> 1210<section id="interactive-mode" class="level2"> 1211<h2 class="anchored" data-anchor-id="interactive-mode">Interactive mode</h2> 1212<p>For the rest of this intro, weâll turn on interactive mode, which partially executes queries to give users a preview of the results. There is a small difference in the way the output is formatted, but otherwise this is the same as calling <code>to_pandas</code> on the table expression with a limit of 10 result rows returned.</p> 1213<div id="750c81c5" class="cell" data-execution_count="6"> 1214<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb11"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>ibis.options.interactive <span class="op">=</span> <span class="va">True</span></span> 1215<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a>penguins.head()</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1216<div class="cell-output cell-output-display" data-execution_count="6"> 1217<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââ³ââââââââââââ³âââââââââââââââââ³ââââââââââââââââ³ââââââââââââââââââââ³ââââââââââââââ³âââââââââ³ââââââââ 1218â<span style="font-weight: bold"> species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> bill_length_mm </span>â<span style="font-weight: bold"> bill_depth_mm </span>â<span style="font-weight: bold"> flipper_length_mm </span>â<span style="font-weight: bold"> body_mass_g </span>â<span style="font-weight: bold"> sex </span>â<span style="font-weight: bold"> year </span>â 1219â¡ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ© 1220â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â 1221âââââââââââ¼ââââââââââââ¼âââââââââââââââââ¼ââââââââââââââââ¼ââââââââââââââââââââ¼ââââââââââââââ¼âââââââââ¼âââââââ⤠1222â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span>
1222 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.7</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">181</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3750</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1223â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.5</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">17.4</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">186</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3800</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1224â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">40.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.0</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">195</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3250</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1225â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1226â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">36.7</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">19.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">193</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3450</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1227âââââââââââ´ââââââââââââ´âââââââââââââââââ´ââââââââââââââââ´ââââââââââââââââââââ´ââââââââââââââ´âââââââââ´ââââââââ 1228</pre> 1229</div> 1230</div> 1231</section> 1232<section id="common-operations" class="level2"> 1233<h2 class="anchored" data-anchor-id="common-operations">Common operations</h2> 1234<p>Ibis has a collection of useful table methods to manipulate and query the data in a table (or tables).</p> 1235<section id="filter" class="level3"> 1236<h3 class="anchored" data-anchor-id="filter">filter</h3> 1237<p><code>filter</code> allows you to select rows based on a condition or set of conditions.</p> 1238<p>We can filter so we only have penguins of the species Adelie:</p> 1239<div id="fdd5a44f" class="cell" data-execution_count="7"> 1240<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb12"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>penguins.<span class="bu">filter</span>(penguins.species <span class="op">==</span> <span class="st">"Adelie"</span>)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1241<div class="cell-output cell-output-display" data-execution_count="7"> 1242<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââ³ââââââââââââ³âââââââââââââââââ³ââââââââââââââââ³ââââââââââââââââââââ³ââââââââââââââ³âââââââââ³ââââââââ 1243â<span style="font-weight: bold">
1243 species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> bill_length_mm </span>â<span style="font-weight: bold"> bill_depth_mm </span>â<span style="font-weight: bold"> flipper_length_mm </span>â<span style="font-weight: bold"> body_mass_g </span>â<span style="font-weight: bold"> sex </span>â<span style="font-weight: bold"> year </span>â 1244â¡ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ© 1245â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â 1246âââââââââââ¼ââââââââââââ¼âââââââââââââââââ¼ââââââââââââââââ¼ââââââââââââââââââââ¼ââââââââââââââ¼âââââââââ¼âââââââ⤠1247â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.7</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">181</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3750</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1248â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.5</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">17.4</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">186</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3800</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1249â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">40.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.0</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">195</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3250</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1250â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span>
1250 â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1251â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">36.7</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">19.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">193</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3450</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1252â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">20.6</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">190</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3650</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1253â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">38.9</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">17.8</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">181</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3625</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1254â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.2</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">19.6</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">195</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4675</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1255â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">34.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">193</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3475</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1256â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span>
1256 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">42.0</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">20.2</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">190</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4250</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1257â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â 1258âââââââââââ´ââââââââââââ´âââââââââââââââââ´ââââââââââââââââ´ââââââââââââââââââââ´ââââââââââââââ´âââââââââ´ââââââââ 1259</pre> 1260</div> 1261</div> 1262<p>Or filter for Adelie penguins that reside on the island of Torgersen:</p> 1263<div id="c08f9180" class="cell" data-execution_count="8"> 1264<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb13"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a>penguins.<span class="bu">filter</span>((penguins.island <span class="op">==</span> <span class="st">"Torgersen"</span>) <span class="op">&</span> (penguins.species <span class="op">==</span> <span class="st">"Adelie"</span>))</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1265<div class="cell-output cell-output-display" data-execution_count="8"> 1266<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââ³ââââââââââââ³âââââââââââââââââ³ââââââââââââââââ³ââââââââââââââââââââ³ââââââââââââââ³âââââââââ³ââââââââ 1267â<span style="font-weight: bold"> species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> bill_length_mm </span>â<span style="font-weight: bold"> bill_depth_mm </span>â<span style="font-weight: bold"> flipper_length_mm </span>â<span style="font-weight: bold"> body_mass_g </span>â<span style="font-weight: bold"> sex </span>â<span style="font-weight: bold"> year </span>â 1268â¡ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ© 1269â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â 1270âââââââââââ¼ââââââââââââ¼âââââââââââââââââ¼ââââââââââââââââ¼ââââââââââââââââââââ¼ââââââââââââââ¼âââââââââ¼âââââââ⤠1271â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span>
1271 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.7</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">181</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3750</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1272â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.5</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">17.4</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">186</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3800</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1273â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">40.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.0</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">195</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3250</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1274â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1275â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">36.7</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">19.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">193</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3450</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1276â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">20.6</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">190</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3650</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1277â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span>
1277 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">38.9</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">17.8</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">181</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3625</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1278â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.2</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">19.6</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">195</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4675</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1279â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">34.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">193</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3475</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1280â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">42.0</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">20.2</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">190</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4250</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1281â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â 1282âââââââââââ´ââââââââââââ´âââââââââââââââââ´ââââââââââââââââ´ââââââââââââââââââââ´ââââââââââââââ´âââââââââ´ââââââââ 1283</pre> 1284</div> 1285</div> 1286<p>You can use any boolean comparison in a filter (although if you try to do something like use <code><</code> on a string, Ibis will yell at you).</p> 1287</section> 1288<section id="select" class="level3"> 1289<h3 class="anchored" data-anchor-id="select">select</h3> 1290<p>Your data analysis might not require all the columns present in a given table. <code>select</code> lets you pick out only those columns that you want to work with.</p> 1291<p>To select a column you can use the name of the column as a string:</p> 1292<div id="25f7635a" class="cell" data-execution_count="9"> 1293<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb14"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a>penguins.select(<span class="st">"species"</span>, <span class="st">"island"</span>, <span class="st">
1293"year"</span>)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1294<div class="cell-output cell-output-display" data-execution_count="9"> 1295<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââ³ââââââââââââ³ââââââââ 1296â<span style="font-weight: bold"> species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> year </span>â 1297â¡ââââââââââââââââââââââââââââââ© 1298â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â 1299âââââââââââ¼ââââââââââââ¼âââââââ⤠1300â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1301â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1302â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1303â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1304â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1305â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1306â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1307â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1308â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1309â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1310â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â 1311âââââââââââ´ââââââââââââ´ââââââââ 1312</pre> 1313</div> 1314</div> 1315<p>Or you can use column objects directly (this can be convenient when paired with tab-completion):</p> 1316<div id="90d96ca4" class="cell" data-execution_count="10"> 1317<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb15"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a>penguins.select(penguins.species, penguins.island, penguins.year)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1318<div class="cell-output cell-output-display" data-execution_count="10"> 1319<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââ³ââââââââââââ³ââââââââ 1320â<span style="font-weight: bold">
1320 species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> year </span>â 1321â¡ââââââââââââââââââââââââââââââ© 1322â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â 1323âââââââââââ¼ââââââââââââ¼âââââââ⤠1324â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1325â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1326â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1327â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1328â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1329â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1330â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1331â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1332â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1333â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1334â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â 1335âââââââââââ´ââââââââââââ´ââââââââ 1336</pre> 1337</div> 1338</div> 1339<p>Or you can mix-and-match:</p> 1340<div id="7437c428" class="cell" data-execution_count="11"> 1341<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb16"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a>penguins.select(<span class="st">"species"</span>, <span class="st">"island"</span>, penguins.year)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1342<div class="cell-output cell-output-display" data-execution_count="11"> 1343<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââ³ââââââââââââ³ââââââââ 1344â<span style="font-weight: bold">
1344 species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> year </span>â 1345â¡ââââââââââââââââââââââââââââââ© 1346â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â 1347âââââââââââ¼ââââââââââââ¼âââââââ⤠1348â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1349â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1350â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1351â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1352â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1353â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1354â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1355â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1356â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1357â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1358â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â 1359âââââââââââ´ââââââââââââ´ââââââââ 1360</pre> 1361</div> 1362</div> 1363</section> 1364<section id="mutate" class="level3"> 1365<h3 class="anchored" data-anchor-id="mutate">mutate</h3> 1366<p><code>mutate</code> lets you add new columns to your table. You can derive them from existing columns, or use constant values with <code>literal</code>.</p> 1367<div id="23ff84f0" class="cell" data-execution_count="12"> 1368<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb17"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a>penguins.mutate(</span> 1369<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a> bill_length_cm<span class="op">=</span>penguins.bill_length_mm <span class="op">/</span> <span class="dv">10</span>,</span> 1370<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a> continent<span class="op">=</span>ibis.literal(<span class="st">"Antarctica"</span>)</span> 1371<span id="cb17-4"><a href="#cb17-4" aria-hidden="true" tabindex="-1"></a>)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1372<div class="cell-output cell-output-display" data-execution_count="12"> 1373<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââ³ââââââââââââ³âââââââââââââââââ³ââââââââââââââââ³ââââââââââââââââââââ³ââââââââââââââ³âââââââââ³ââââââââ³âââââââââââââââââ³âââââââââââââ 1374â<span style="font-weight: bold">
1374 species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> bill_length_mm </span>â<span style="font-weight: bold"> bill_depth_mm </span>â<span style="font-weight: bold"> flipper_length_mm </span>â<span style="font-weight: bold"> body_mass_g </span>â<span style="font-weight: bold"> sex </span>â<span style="font-weight: bold"> year </span>â<span style="font-weight: bold"> bill_length_cm </span>â<span style="font-weight: bold"> continent </span>â 1375â¡ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ© 1376â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â 1377âââââââââââ¼ââââââââââââ¼âââââââââââââââââ¼ââââââââââââââââ¼ââââââââââââââââââââ¼ââââââââââââââ¼âââââââââ¼ââââââââ¼âââââââââââââââââ¼ââââââââââââ⤠1378â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.7</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">181</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3750</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.91</span> â <span style="color: #008000; text-decoration-color: #008000">Antarctica</span> â 1379â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.5</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">17.4</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">186</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3800</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.95</span> â <span style="color: #008000; text-decoration-color: #008000">Antarctica</span> â 1380â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span>
1380 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">40.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.0</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">195</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3250</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4.03</span> â <span style="color: #008000; text-decoration-color: #008000">Antarctica</span> â 1381â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008000; text-decoration-color: #008000">Antarctica</span> â 1382â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">36.7</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">19.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">193</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3450</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.67</span> â <span style="color: #008000; text-decoration-color: #008000">Antarctica</span> â 1383â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">20.6</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">190</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3650</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.93</span> â <span style="color: #008000; text-decoration-color: #008000">Antarctica</span> â 1384â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">38.9</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">17.8</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">181</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3625</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span>
1384 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.89</span> â <span style="color: #008000; text-decoration-color: #008000">Antarctica</span> â 1385â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.2</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">19.6</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">195</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4675</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.92</span> â <span style="color: #008000; text-decoration-color: #008000">Antarctica</span> â 1386â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">34.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">193</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3475</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.41</span> â <span style="color: #008000; text-decoration-color: #008000">Antarctica</span> â 1387â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">42.0</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">20.2</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">190</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4250</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4.20</span> â <span style="color: #008000; text-decoration-color: #008000">Antarctica</span> â 1388â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â 1389âââââââââââ´ââââââââââââ´âââââââââââââââââ´ââââââââââââââââ´ââââââââââââââââââââ´ââââââââââââââ´âââââââââ´ââââââââ´âââââââââââââââââ´âââââââââââââ 1390</pre> 1391</div> 1392</div> 1393<p>Notice that the table is a little too wide to display all the columns now (depending on your screen-size). <code>bill_length</code> is now present in millimeters AND centimeters. Use a <code>select</code> to trim down the number of columns weâre looking at.</p> 1394<div id="95d4d82e" class="cell" data-execution_count="13"> 1395<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb18"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a>penguins.mutate(bill_length_cm<span class="op">=</span>penguins.bill_length_mm <span class="op">/</span> <span class="dv">10</span>).select(</span> 1396<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a> <span class="st">"species"</span>,</span> 1397<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a> <span class="st">"island"</span>,</span> 1398<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a> <span class="st">"bill_depth_mm"</span>,</span> 1399<span id="cb18-5"><a href="#cb18-5" aria-hidden="true" tabindex="-1"></a> <span class="st">"flipper_length_mm"</span>,</span> 1400<span id="cb18-6"><a href="#cb18-6" aria-hidden="true" tabindex="-1"></a> <span class="st">"body_mass_g"</span>,</span> 1401<span id="cb18-7"><a href="#cb18-7" aria-hidden="true" tabindex="-1"></a> <span class="st">"sex"</span>,</span> 1402<span id="cb18-8"><a href="#cb18-8" aria-hidden="true" tabindex="-1"></a> <span class="st">
1402"year"</span>,</span> 1403<span id="cb18-9"><a href="#cb18-9" aria-hidden="true" tabindex="-1"></a> <span class="st">"bill_length_cm"</span>,</span> 1404<span id="cb18-10"><a href="#cb18-10" aria-hidden="true" tabindex="-1"></a>)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1405<div class="cell-output cell-output-display" data-execution_count="13"> 1406<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââ³ââââââââââââ³ââââââââââââââââ³ââââââââââââââââââââ³ââââââââââââââ³âââââââââ³ââââââââ³âââââââââââââââââ 1407â<span style="font-weight: bold"> species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> bill_depth_mm </span>â<span style="font-weight: bold"> flipper_length_mm </span>â<span style="font-weight: bold"> body_mass_g </span>â<span style="font-weight: bold"> sex </span>â<span style="font-weight: bold"> year </span>â<span style="font-weight: bold"> bill_length_cm </span>â 1408â¡ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ© 1409â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â 1410âââââââââââ¼ââââââââââââ¼ââââââââââââââââ¼ââââââââââââââââââââ¼ââââââââââââââ¼âââââââââ¼ââââââââ¼ââââââââââââââââ⤠1411â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.7</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">181</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3750</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.91</span> â 1412â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">17.4</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">186</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3800</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.95</span> â 1413â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span>
1413 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.0</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">195</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3250</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4.03</span> â 1414â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â 1415â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">19.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">193</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3450</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.67</span> â 1416â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">20.6</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">190</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3650</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.93</span> â 1417â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">17.8</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">181</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3625</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.89</span> â 1418â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">19.6</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">195</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4675</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span>
1418 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.92</span> â 1419â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">193</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3475</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.41</span> â 1420â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">20.2</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">190</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4250</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4.20</span> â 1421â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â 1422âââââââââââ´ââââââââââââ´ââââââââââââââââ´ââââââââââââââââââââ´ââââââââââââââ´âââââââââ´ââââââââ´âââââââââââââââââ 1423</pre> 1424</div> 1425</div> 1426</section> 1427<section id="selectors" class="level3"> 1428<h3 class="anchored" data-anchor-id="selectors">selectors</h3> 1429<p>Typing out ALL of the column names <em>except</em> one is a little annoying. Instead of doing that again, we can use a <code>selector</code> to quickly select or deselect groups of columns.</p> 1430<div id="74fc8cb5" class="cell" data-execution_count="14"> 1431<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb19"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> ibis.selectors <span class="im">as</span> s</span> 1432<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a></span> 1433<span id="cb19-3"><a href="#cb19-3" aria-hidden="true" tabindex="-1"></a>penguins.mutate(bill_length_cm<span class="op">=</span>penguins.bill_length_mm <span class="op">/</span> <span class="dv">10</span>).select(</span> 1434<span id="cb19-4"><a href="#cb19-4" aria-hidden="true" tabindex="-1"></a> <span class="op">~</span>s.matches(<span class="st">"bill_length_mm"</span>)</span> 1435<span id="cb19-5"><a href="#cb19-5" aria-hidden="true" tabindex="-1"></a> <span class="co"># match every column except `bill_length_mm`</span></span> 1436<span id="cb19-6"><a href="#cb19-6" aria-hidden="true" tabindex="-1"></a>)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1437<div class="cell-output cell-output-display" data-execution_count="14"> 1438<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââ³ââââââââââââ³ââââââââââââââââ³ââââââââââââââââââââ³ââââââââââââââ³âââââââââ³ââââââââ³âââââââââââââââââ 1439â<span style="font-weight: bold">
1439 species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> bill_depth_mm </span>â<span style="font-weight: bold"> flipper_length_mm </span>â<span style="font-weight: bold"> body_mass_g </span>â<span style="font-weight: bold"> sex </span>â<span style="font-weight: bold"> year </span>â<span style="font-weight: bold"> bill_length_cm </span>â 1440â¡ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ© 1441â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â 1442âââââââââââ¼ââââââââââââ¼ââââââââââââââââ¼ââââââââââââââââââââ¼ââââââââââââââ¼âââââââââ¼ââââââââ¼ââââââââââââââââ⤠1443â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.7</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">181</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3750</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.91</span> â 1444â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">17.4</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">186</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3800</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.95</span> â 1445â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.0</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">195</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3250</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4.03</span> â 1446â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span>
1446 â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â 1447â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">19.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">193</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3450</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.67</span> â 1448â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">20.6</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">190</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3650</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.93</span> â 1449â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">17.8</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">181</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3625</span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.89</span> â 1450â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">19.6</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">195</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4675</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.92</span> â 1451â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">193</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3475</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span>
1451 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3.41</span> â 1452â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">20.2</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">190</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4250</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4.20</span> â 1453â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â 1454âââââââââââ´ââââââââââââ´ââââââââââââââââ´ââââââââââââââââââââ´ââââââââââââââ´âââââââââ´ââââââââ´âââââââââââââââââ 1455</pre> 1456</div> 1457</div> 1458<p>You can also use a <code>selector</code> alongside a column name.</p> 1459<div id="1eb31ed5" class="cell" data-execution_count="15"> 1460<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb20"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a>penguins.select(<span class="st">"island"</span>, s.numeric())</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1461<div class="cell-output cell-output-display" data-execution_count="15"> 1462<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââââ³âââââââââââââââââ³ââââââââââââââââ³ââââââââââââââââââââ³ââââââââââââââ³ââââââââ 1463â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> bill_length_mm </span>â<span style="font-weight: bold"> bill_depth_mm </span>â<span style="font-weight: bold"> flipper_length_mm </span>â<span style="font-weight: bold"> body_mass_g </span>â<span style="font-weight: bold"> year </span>â 1464â¡âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ© 1465â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â 1466âââââââââââââ¼âââââââââââââââââ¼ââââââââââââââââ¼ââââââââââââââââââââ¼ââââââââââââââ¼âââââââ⤠1467â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span>
1467 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.7</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">181</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3750</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1468â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.5</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">17.4</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">186</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3800</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1469â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">40.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.0</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">195</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3250</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1470â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1471â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">36.7</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">19.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">193</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3450</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1472â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.3</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">20.6</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">190</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3650</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1473â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">38.9</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">17.8</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">181</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3625</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1474â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span>
1474 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">39.2</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">19.6</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">195</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4675</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1475â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">34.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18.1</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">193</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3475</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1476â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">42.0</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">20.2</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">190</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4250</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â 1477â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â 1478âââââââââââââ´âââââââââââââââââ´ââââââââââââââââ´ââââââââââââââââââââ´ââââââââââââââ´ââââââââ 1479</pre> 1480</div> 1481</div> 1482<p>You can read more about <a href="../posts/selectors"><code>selectors</code></a> in the docs!</p> 1483</section> 1484<section id="order_by" class="level3"> 1485<h3 class="anchored" data-anchor-id="order_by">order_by</h3> 1486<p><code>order_by</code> arranges the values of one or more columns in ascending or descending order.</p> 1487<p>By default, <code>ibis</code> sorts in ascending order:</p> 1488<div id="2a371658" class="cell" data-execution_count="16"> 1489<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb21"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a>penguins.order_by(penguins.flipper_length_mm).select(</span> 1490<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a> <span class="st">"species"</span>, <span class="st">"island"</span>, <span class="st">"flipper_length_mm"</span></span> 1491<span id="cb21-3"><a href="#cb21-3" aria-hidden="true" tabindex="-1"></a>)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1492<div class="cell-output cell-output-display" data-execution_count="16"> 1493<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââââ³ââââââââââââ³ââââââââââââââââââââ 1494â<span style="font-weight: bold"> species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> flipper_length_mm </span>â 1495â¡ââââââââââââââââââââââââââââââââââââââââââââ© 1496â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â 1497âââââââââââââ¼ââââââââââââ¼âââââââââââââââââââ⤠1498â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span>
1498 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">172</span> â 1499â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">174</span> â 1500â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">176</span> â 1501â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">178</span> â 1502â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">178</span> â 1503â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">178</span> â 1504â <span style="color: #008000; text-decoration-color: #008000">Chinstrap</span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">178</span> â 1505â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">179</span> â 1506â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">180</span> â 1507â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">180</span> â 1508â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â 1509âââââââââââââ´ââââââââââââ´ââââââââââââââââââââ 1510</pre> 1511</div> 1512</div> 1513<p>You can sort in descending order using the <code>desc</code> method of a column:</p> 1514<div id="bd0b1791" class="cell" data-execution_count="17"> 1515<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb22"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a>penguins.order_by(penguins.flipper_length_mm.desc()).select(</span> 1516<span id="cb22-2"><a href="#cb22-2" aria-hidden="true" tabindex="-1"></a> <span class="st">"species"</span>, <span class="st">"island"</span>, <span class="st">"flipper_length_mm"</span></span> 1517<span id="cb22-3"><a href="#cb22-3" aria-hidden="true" tabindex="-1"></a>)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1518<div class="cell-output cell-output-display" data-execution_count="17"> 1519<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââ³âââââââââ³ââââââââââââââââââââ 1520â<span style="font-weight: bold">
1520 species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> flipper_length_mm </span>â 1521â¡âââââââââââââââââââââââââââââââââââââââ© 1522â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â 1523âââââââââââ¼âââââââââ¼âââââââââââââââââââ⤠1524â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">231</span> â 1525â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">230</span> â 1526â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">230</span> â 1527â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">230</span> â 1528â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">230</span> â 1529â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">230</span> â 1530â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">230</span> â 1531â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">230</span> â 1532â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">229</span> â 1533â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">229</span> â 1534â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â 1535âââââââââââ´âââââââââ´ââââââââââââââââââââ 1536</pre> 1537</div> 1538</div> 1539<p>Or you can use <code>ibis.desc</code></p> 1540<div id="597ccdb0" class="cell" data-execution_count="18"> 1541<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb23"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a>penguins.order_by(ibis.desc(<span class="st">"flipper_length_mm"</span>)).select(</span> 1542<span id="cb23-2"><a href="#cb23-2" aria-hidden="true" tabindex="-1"></a> <span class="st">"species"</span>, <span class="st">"island"</span>, <span class="st">"flipper_length_mm"</span></span> 1543<span id="cb23-3"><a href="#cb23-3" aria-hidden="true" tabindex="-1"></a>)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1544<div class="cell-output cell-output-display" data-execution_count="18"> 1545<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââ³âââââââââ³ââââââââââââââââââââ 1546â<span style="font-weight: bold">
1546 species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> flipper_length_mm </span>â 1547â¡âââââââââââââââââââââââââââââââââââââââ© 1548â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â 1549âââââââââââ¼âââââââââ¼âââââââââââââââââââ⤠1550â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">231</span> â 1551â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">230</span> â 1552â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">230</span> â 1553â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">230</span> â 1554â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">230</span> â 1555â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">230</span> â 1556â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">230</span> â 1557â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">230</span> â 1558â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">229</span> â 1559â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">229</span> â 1560â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â 1561âââââââââââ´âââââââââ´ââââââââââââââââââââ 1562</pre> 1563</div> 1564</div> 1565</section> 1566<section id="aggregates" class="level3"> 1567<h3 class="anchored" data-anchor-id="aggregates">aggregates</h3> 1568<p>Ibis has several aggregate functions available to help summarize data.</p> 1569<p><code>mean</code>, <code>max</code>, <code>min</code>, <code>count</code>, <code>sum</code> (the list goes on).</p> 1570<p>To aggregate an entire column, call the corresponding method on that column.</p> 1571<div id="fdeefaae" class="cell" data-execution_count="19"> 1572<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb24"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a>penguins.flipper_length_mm.mean()</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1573<div class="cell-output cell-output-display" data-execution_count="19"> 1574<div class="ansi-escaped-output"> 1575<pre>ââââââââââââââ 1576â <span class="ansi-cyan-fg ansi-bold">200.915205</span> â 1577ââââââââââââââ</pre> 1578</div> 1579</div> 1580</div> 1581<p>You can compute multiple aggregates at once using the <code>aggregate</code> method:</p> 1582<div id="0a288371" class="cell" data-execution_count="20"> 1583<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb25"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a>penguins.aggregate([penguins.flipper_length_mm.mean(), penguins.bill_depth_mm.<span class="bu">max</span>()])</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1584<div class="cell-output cell-output-display" data-execution_count="20"> 1585<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââââââââââââââââââ³âââââââââââââââââââââ 1586â<span style="font-weight: bold"> Mean(flipper_length_mm) </span>â<span style="font-weight: bold"> Max(bill_depth_mm) </span>â 1587â¡âââââââââââââââââââââââââââââââââââââââââââââââ© 1588â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â 1589âââââââââââââââââââââââââââ¼âââââââââââââââââââââ¤
1590â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">200.915205</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">21.5</span> â 1591âââââââââââââââââââââââââââ´âââââââââââââââââââââ 1592</pre> 1593</div> 1594</div> 1595<p>But <code>aggregate</code> <em>really</em> shines when itâs paired with <code>group_by</code>.</p> 1596</section> 1597<section id="group_by" class="level3"> 1598<h3 class="anchored" data-anchor-id="group_by">group_by</h3> 1599<p><code>group_by</code> creates groupings of rows that have the same value for one or more columns.</p> 1600<p>But it doesnât do much on its own â you can pair it with <code>aggregate</code> to get a result.</p> 1601<div id="f95e357d" class="cell" data-execution_count="21"> 1602<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb26"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a>penguins.group_by(<span class="st">"species"</span>).aggregate()</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1603<div class="cell-output cell-output-display" data-execution_count="21"> 1604<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââââ 1605â<span style="font-weight: bold"> species </span>â 1606â¡ââââââââââââ© 1607â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â 1608ââââââââââââ⤠1609â <span style="color: #008000; text-decoration-color: #008000">Chinstrap</span> â 1610â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â 1611â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â 1612âââââââââââââ 1613</pre> 1614</div> 1615</div> 1616<p>We grouped by the <code>species</code> column and handed it an âemptyâ aggregate command. The result of that is a column of the unique values in the <code>species</code> column.</p> 1617<p>If we add a second column to the <code>group_by</code>, weâll get each unique pairing of the values in those columns.</p> 1618<div id="f3f72669" class="cell" data-execution_count="22"> 1619<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb27"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a>penguins.group_by([<span class="st">"species"</span>, <span class="st">"island"</span>]).aggregate()</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1620<div class="cell-output cell-output-display" data-execution_count="22"> 1621<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââââ³ââââââââââââ 1622â<span style="font-weight: bold"> species </span>â<span style="font-weight: bold"> island </span>â 1623â¡ââââââââââââââââââââââââ© 1624â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â 1625âââââââââââââ¼âââââââââââ⤠1626â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â 1627â <span style="color: #008000; text-decoration-color: #008000">Chinstrap</span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â 1628â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â 1629â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â 1630â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â 1631âââââââââââââ´ââââââââââââ 1632</pre> 1633</div> 1634</div> 1635<p>Now, if we add an aggregation function to that, we start to really open things up.</p> 1636<div id="2c823348" class="cell" data-execution_count="23"> 1637<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb28"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true" tabindex="-1"></a>penguins.group_by([<span class="st">"species"</span>, <span class="st">"island"</span>]).aggregate(penguins.bill_length_mm.mean())</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1638<div class="cell-output cell-output-display" data-execution_count="23"> 1639<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââââ³ââââââââââââ³âââââââââââââââââââââââ 1640â<span style="font-weight: bold"> species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> Mean(bill_length_mm) </span>â 1641â¡âââââââââââââââââââââââââââââââââââââââââââââââ© 1642â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â 1643âââââââââââââ¼ââââââââââââ¼ââââââââââââââââââââââ⤠1644â <span style="color: #008000; text-decoration-color: #008000">Chinstrap</span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span>
1644 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">48.833824</span> â 1645â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">38.950980</span> â 1646â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">38.501786</span> â 1647â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">47.504878</span> â 1648â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">38.975000</span> â 1649âââââââââââââ´ââââââââââââ´âââââââââââââââââââââââ 1650</pre> 1651</div> 1652</div> 1653<p>By adding that <code>mean</code> to the <code>aggregate</code>, we now have a concise way to calculate aggregates over each of the distinct groups in the <code>group_by</code>. And we can calculate as many aggregates as we need.</p> 1654<div id="7de32d86" class="cell" data-execution_count="24"> 1655<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb29"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb29-1"><a href="#cb29-1" aria-hidden="true" tabindex="-1"></a>penguins.group_by([<span class="st">"species"</span>, <span class="st">"island"</span>]).aggregate(</span> 1656<span id="cb29-2"><a href="#cb29-2" aria-hidden="true" tabindex="-1"></a> [penguins.bill_length_mm.mean(), penguins.flipper_length_mm.<span class="bu">max</span>()]</span> 1657<span id="cb29-3"><a href="#cb29-3" aria-hidden="true" tabindex="-1"></a>)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1658<div class="cell-output cell-output-display" data-execution_count="24"> 1659<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââââ³ââââââââââââ³âââââââââââââââââââââââ³âââââââââââââââââââââââââ 1660â<span style="font-weight: bold"> species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> Mean(bill_length_mm) </span>â<span style="font-weight: bold"> Max(flipper_length_mm) </span>â 1661â¡ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ© 1662â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â 1663âââââââââââââ¼ââââââââââââ¼âââââââââââââââââââââââ¼ââââââââââââââââââââââââ⤠1664â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">38.975000</span>
1664 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">203</span> â 1665â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">38.950980</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">210</span> â 1666â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">38.501786</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">208</span> â 1667â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">47.504878</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">231</span> â 1668â <span style="color: #008000; text-decoration-color: #008000">Chinstrap</span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">48.833824</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">212</span> â 1669âââââââââââââ´ââââââââââââ´âââââââââââââââââââââââ´âââââââââââââââââââââââââ 1670</pre> 1671</div> 1672</div> 1673<p>If we need more specific groups, we can add to the <code>group_by</code>.</p> 1674<div id="f3176dc7" class="cell" data-execution_count="25"> 1675<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb30"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a>penguins.group_by([<span class="st">"species"</span>, <span class="st">"island"</span>, <span class="st">"sex"</span>]).aggregate(</span> 1676<span id="cb30-2"><a href="#cb30-2" aria-hidden="true" tabindex="-1"></a> [penguins.bill_length_mm.mean(), penguins.flipper_length_mm.<span class="bu">max</span>()]</span> 1677<span id="cb30-3"><a href="#cb30-3" aria-hidden="true" tabindex="-1"></a>)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1678<div class="cell-output cell-output-display" data-execution_count="25"> 1679<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââââ³ââââââââââââ³âââââââââ³âââââââââââââââââââââââ³âââââââââââââââââââââââââ 1680â<span style="font-weight: bold"> species </span>â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> sex </span>â<span style="font-weight: bold"> Mean(bill_length_mm) </span>â<span style="font-weight: bold"> Max(flipper_length_mm) </span>â 1681â¡âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ© 1682â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">float64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â 1683âââââââââââââ¼ââââââââââââ¼âââââââââ¼âââââââââââââââââââââââ¼ââââââââââââââââââââââââ⤠1684â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span>
1684 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">37.925000</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">193</span> â 1685â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">36.911111</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">202</span> â 1686â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">49.473770</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">231</span> â 1687â <span style="color: #008000; text-decoration-color: #008000">Chinstrap</span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">46.573529</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">202</span> â 1688â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">40.071429</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">208</span> â 1689â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â <span style="color: #008000; text-decoration-color: #008000">female</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">45.563793</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">222</span> â 1690â <span style="color: #008000; text-decoration-color: #008000">Chinstrap</span> â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">51.094118</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">212</span> â 1691â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">40.586957</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">210</span> â 1692â <span style="color: #008000; text-decoration-color: #008000">Adelie </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â <span style="color: #008000; text-decoration-color: #008000">male </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">40.590909</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">203</span> â 1693â <span style="color: #008000; text-decoration-color: #008000">Gentoo </span> â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">NULL</span>
1693 â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">45.625000</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">217</span> â 1694â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">â¦</span> â 1695âââââââââââââ´ââââââââââââ´âââââââââ´âââââââââââââââââââââââ´âââââââââââââââââââââââââ 1696</pre> 1697</div> 1698</div> 1699</section> 1700</section> 1701<section id="chaining-it-all-together" class="level2"> 1702<h2 class="anchored" data-anchor-id="chaining-it-all-together">Chaining it all together</h2> 1703<p>Weâve already chained some Ibis calls together. We used <code>mutate</code> to create a new column and then <code>select</code> to only view a subset of the new table. We were just chaining <code>group_by</code> with <code>aggregate</code>.</p> 1704<p>Thereâs nothing stopping us from putting all of these concepts together to ask questions of the data.</p> 1705<p>How about:</p> 1706<ul> 1707<li>What was the largest female penguin (by body mass) on each island in the year 2008?</li> 1708</ul> 1709<div id="51e6359c" class="cell" data-execution_count="26"> 1710<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb31"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb31-1"><a href="#cb31-1" aria-hidden="true" tabindex="-1"></a>penguins.<span class="bu">filter</span>((penguins.sex <span class="op">==</span> <span class="st">"female"</span>) <span class="op">&</span> (penguins.year <span class="op">==</span> <span class="dv">2008</span>)).group_by(</span> 1711<span id="cb31-2"><a href="#cb31-2" aria-hidden="true" tabindex="-1"></a> [<span class="st">"island"</span>]</span> 1712<span id="cb31-3"><a href="#cb31-3" aria-hidden="true" tabindex="-1"></a>).aggregate(penguins.body_mass_g.<span class="bu">max</span>())</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1713<div class="cell-output cell-output-display" data-execution_count="26"> 1714<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââââ³âââââââââââââââââââ 1715â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> Max(body_mass_g) </span>â 1716â¡âââââââââââââââââââââââââââââââ© 1717â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â 1718âââââââââââââ¼ââââââââââââââââââ⤠1719â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">5200</span> â 1720â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3800</span> â 1721â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3900</span> â 1722âââââââââââââ´âââââââââââââââââââ 1723</pre> 1724</div> 1725</div> 1726<ul> 1727<li>What about the largest male penguin (by body mass) on each island for each year of data collection?</li> 1728</ul> 1729<div id="67664ffe" class="cell" data-execution_count="27"> 1730<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb32"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb32-1"><a href="#cb32-1" aria-hidden="true" tabindex="-1"></a>penguins.<span class="bu">filter</span>(penguins.sex <span class="op">==</span> <span class="st">
1730"male"</span>).group_by([<span class="st">"island"</span>, <span class="st">"year"</span>]).aggregate(</span> 1731<span id="cb32-2"><a href="#cb32-2" aria-hidden="true" tabindex="-1"></a> penguins.body_mass_g.<span class="bu">max</span>().name(<span class="st">"max_body_mass"</span>)</span> 1732<span id="cb32-3"><a href="#cb32-3" aria-hidden="true" tabindex="-1"></a>).order_by([<span class="st">"year"</span>, <span class="st">"max_body_mass"</span>])</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div> 1733<div class="cell-output cell-output-display" data-execution_count="27"> 1734<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">âââââââââââââ³ââââââââ³ââââââââââââââââ 1735â<span style="font-weight: bold"> island </span>â<span style="font-weight: bold"> year </span>â<span style="font-weight: bold"> max_body_mass </span>â 1736â¡ââââââââââââââââââââââââââââââââââââ© 1737â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">string</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">int64</span> â 1738âââââââââââââ¼ââââââââ¼âââââââââââââââ⤠1739â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4650</span> â 1740â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4675</span> â 1741â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2007</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">6300</span> â 1742â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2008</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4700</span> â 1743â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2008</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4800</span> â 1744â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2008</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">6000</span> â 1745â <span style="color: #008000; text-decoration-color: #008000">Torgersen</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2009</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4300</span> â 1746â <span style="color: #008000; text-decoration-color: #008000">Dream </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2009</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">4475</span> â 1747â <span style="color: #008000; text-decoration-color: #008000">Biscoe </span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2009</span> â <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">6000</span> â 1748âââââââââââââ´ââââââââ´ââââââââââââââââ 1749</pre> 1750</div> 1751</div> 1752</section> 1753<section id="learn-more" class="level2"> 1754<h2 class="anchored" data-anchor-id="learn-more">Learn more</h2> 1755<p>Thatâs all for this quick-start guide. If you want to learn more, check out the <a href="https://github.com/ibis-project/ibis-examples">examples repository</a>.</p> 1756 1757 1758</section> 1759 1760
1761<a onclick="window.scrollTo(0, 0); return false;" role="button" id="quarto-back-to-top"><i class="bi bi-arrow-up"></i> Back to top</a><div id="quarto-appendix" class="default"><section id="footnotes" class="footnotes footnotes-end-of-document" role="doc-endnotes"><h2 class="anchored quarto-appendix-heading">Footnotes</h2> 1762 1763<ol> 1764<li id="fn1"><p>Horst AM, Hill AP, Gorman KB (2020). palmerpenguins: Palmer Archipelago (Antarctica) penguin data. R package version 0.1.0. https://allisonhorst.github.io/palmerpenguins/. doi: 10.5281/zenodo.3960218.<a href="#fnref1" class="footnote-back" role="doc-backlink">â©ï¸</a></p></li> 1765</ol> 1766</section></div></main> <!-- /main -->
1767<script id="quarto-html-after-body" type="application/javascript"> 1768 window.document.addEventListener("DOMContentLoaded", function (event) { 1769 // Ensure there is a toggle, if there isn't float one in the top right 1770 if (window.document.querySelector('.quarto-color-scheme-toggle') === null) { 1771 const a = window.document.createElement('a'); 1772 a.classList.add('top-right'); 1773 a.classList.add('quarto-color-scheme-toggle'); 1774 a.href = ""; 1775 a.onclick = function() { try { window.quartoToggleColorScheme(); } catch {} return false; }; 1776 const i = window.document.createElement("i"); 1777 i.classList.add('bi'); 1778 a.appendChild(i); 1779 window.document.body.appendChild(a); 1780 } 1781 setColorSchemeToggle(hasAlternateSentinel()) 1782 const icon = "î§"; 1783 const anchorJS = new window.AnchorJS(); 1784 anchorJS.options = { 1785 placement: 'right', 1786 icon: icon 1787 }; 1788 anchorJS.add('.anchored'); 1789 const isCodeAnnotation = (el) => { 1790 for (const clz of el.classList) { 1791 if (clz.startsWith('code-annotation-')) { 1792 return true; 1793 } 1794 } 1795 return false; 1796 } 1797 const onCopySuccess = function(e) { 1798 // button target 1799 const button = e.trigger; 1800 // don't keep focus 1801 button.blur(); 1802 // flash "checked" 1803 button.classList.add('code-copy-button-checked'); 1804 var currentTitle = button.getAttribute("title"); 1805 button.setAttribute("title", "Copied!"); 1806 let tooltip; 1807 if (window.bootstrap) { 1808 button.setAttribute("data-bs-toggle", "tooltip"); 1809 button.setAttribute("data-bs-placement", "left"); 1810 button.setAttribute("data-bs-title", "Copied!"); 1811 tooltip = new bootstrap.Tooltip(button, 1812 { trigger: "manual", 1813 customClass: "code-copy-button-tooltip", 1814 offset: [0, -8]}); 1815 tooltip.show(); 1816 } 1817 setTimeout(function() { 1818 if (tooltip) { 1819 tooltip.hide(); 1820 button.removeAttribute("data-bs-title"); 1821 button.removeAttribute("data-bs-toggle"); 1822 button.removeAttribute("data-bs-placement"); 1823 } 1824 button.setAttribute("title", currentTitle); 1825 button.classList.remove('code-copy-button-checked'); 1826 }, 1000); 1827 // clear code selection 1828 e.clearSelection(); 1829 } 1830 const getTextToCopy = function(trigger) { 1831 const outerScaffold = trigger.parentElement.cloneNode(true); 1832 const codeEl = outerScaffold.querySelector('code'); 1833 for (const childEl of codeEl.children) { 1834 if (isCodeAnnotation(childEl)) { 1835 childEl.remove(); 1836 } 1837 } 1838 return codeEl.innerText; 1839 } 1840 const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', { 1841 text: getTextToCopy 1842 }); 1843 clipboard.on('success', onCopySuccess); 1844 if (window.document.getElementById('quarto-embedded-source-code-modal')) { 1845 const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', { 1846 text: getTextToCopy, 1847 container: window.document.getElementById('quarto-embedded-source-code-modal') 1848 }); 1849 clipboardModal.on('success', onCopySuccess); 1850 } 1851 var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//); 1852 var mailtoRegex = new RegExp(/^mailto:/); 1853 var filterRegex = new RegExp("https:\/\/ibis-project\.org"); 1854 var isInternal = (href) => { 1855 return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href); 1856 } 1857 // Inspect non-navigation links and adorn them if external 1858 var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool):not(.about-link)'); 1859 for (var i=0; i<links.length; i++) { 1860 const link = links[i]; 1861 if (!isInternal(link.href)) { 1862 // undo the damage that might have been done by quarto-nav.js in the case of 1863 // links that we want to consider external 1864 if (link.dataset.originalHref !== undefined) { 1865 link.href = link.dataset.originalHref; 1866 } 1867 } 1868 } 1869 function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) { 1870 const config = { 1871 allowHTML: true, 1872 maxWidth: 500, 1873 delay: 100,
1874 arrow: false, 1875 appendTo: function(el) { 1876 return el.parentElement; 1877 }, 1878 interactive: true, 1879 interactiveBorder: 10, 1880 theme: 'quarto', 1881 placement: 'bottom-start', 1882 }; 1883 if (contentFn) { 1884 config.content = contentFn; 1885 } 1886 if (onTriggerFn) { 1887 config.onTrigger = onTriggerFn; 1888 } 1889 if (onUntriggerFn) { 1890 config.onUntrigger = onUntriggerFn; 1891 } 1892 window.tippy(el, config); 1893 } 1894 const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]'); 1895 for (var i=0; i<noterefs.length; i++) { 1896 const ref = noterefs[i]; 1897 tippyHover(ref, function() { 1898 // use id or data attribute instead here 1899 let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href'); 1900 try { href = new URL(href).hash; } catch {} 1901 const id = href.replace(/^#\/?/, ""); 1902 const note = window.document.getElementById(id); 1903 if (note) { 1904 return note.innerHTML; 1905 } else { 1906 return ""; 1907 } 1908 }); 1909 } 1910 const xrefs = window.document.querySelectorAll('a.quarto-xref'); 1911 const processXRef = (id, note) => { 1912 // Strip column container classes 1913 const stripColumnClz = (el) => { 1914 el.classList.remove("page-full", "page-columns"); 1915 if (el.children) { 1916 for (const child of el.children) { 1917 stripColumnClz(child); 1918 } 1919 } 1920 } 1921 stripColumnClz(note) 1922 if (id === null || id.startsWith('sec-')) { 1923 // Special case sections, only their first couple elements 1924 const container = document.createElement("div"); 1925 if (note.children && note.children.length > 2) { 1926 container.appendChild(note.children[0].cloneNode(true)); 1927 for (let i = 1; i < note.children.length; i++) { 1928 const child = note.children[i]; 1929 if (child.tagName === "P" && child.innerText === "") { 1930 continue; 1931 } else { 1932 container.appendChild(child.cloneNode(true)); 1933 break; 1934 } 1935 } 1936 if (window.Quarto?.typesetMath) { 1937 window.Quarto.typesetMath(container); 1938 } 1939 return container.innerHTML 1940 } else { 1941 if (window.Quarto?.typesetMath) { 1942 window.Quarto.typesetMath(note); 1943 } 1944 return note.innerHTML; 1945 } 1946 } else { 1947 // Remove any anchor links if they are present 1948 const anchorLink = note.querySelector('a.anchorjs-link'); 1949 if (anchorLink) { 1950 anchorLink.remove(); 1951 } 1952 if (window.Quarto?.typesetMath) { 1953 window.Quarto.typesetMath(note); 1954 } 1955 if (note.classList.contains("callout")) { 1956 return note.outerHTML; 1957 } else { 1958 return note.innerHTML; 1959 } 1960 } 1961 } 1962 for (var i=0; i<xrefs.length; i++) { 1963 const xref = xrefs[i]; 1964 tippyHover(xref, undefined, function(instance) { 1965 instance.disable(); 1966 let url = xref.getAttribute('href'); 1967 let hash = undefined; 1968 if (url.startsWith('#')) { 1969 hash = url; 1970 } else { 1971 try { hash = new URL(url).hash; } catch {} 1972 } 1973 if (hash) { 1974 const id = hash.replace(/^#\/?/, ""); 1975 const note = window.document.getElementById(id); 1976 if (note !== null) { 1977 try { 1978 const html = processXRef(id, note.cloneNode(true)); 1979 instance.setContent(html); 1980 } finally { 1981 instance.enable(); 1982 instance.show(); 1983 } 1984 } else { 1985 // See if we can fetch this 1986 fetch(url.split('#')[0]) 1987 .then(res => res.text()) 1988 .then(html => { 1989 const parser = new DOMParser(); 1990 const htmlDoc = parser.parseFromString(html, "text/html"); 1991 const note = htmlDoc.getElementById(id); 1992 if (note !== null) { 1993 const html = processXRef(id, note); 1994 instance.setContent(html); 1995 } 1996 }).finally(() => { 1997 instance.enable(); 1998 instance.show(); 1999 }); 2000 } 2001 } else { 2002 // See if we can fetch a full url (with no hash to target)
2003 // This is a special case and we should probably do some content thinning / targeting 2004 fetch(url) 2005 .then(res => res.text()) 2006 .then(html => { 2007 const parser = new DOMParser(); 2008 const htmlDoc = parser.parseFromString(html, "text/html"); 2009 const note = htmlDoc.querySelector('main.content'); 2010 if (note !== null) { 2011 // This should only happen for chapter cross references 2012 // (since there is no id in the URL) 2013 // remove the first header 2014 if (note.children.length > 0 && note.children[0].tagName === "HEADER") { 2015 note.children[0].remove(); 2016 } 2017 const html = processXRef(null, note); 2018 instance.setContent(html); 2019 } 2020 }).finally(() => { 2021 instance.enable(); 2022 instance.show(); 2023 }); 2024 } 2025 }, function(instance) { 2026 }); 2027 } 2028 let selectedAnnoteEl; 2029 const selectorForAnnotation = ( cell, annotation) => { 2030 let cellAttr = 'data-code-cell="' + cell + '"'; 2031 let lineAttr = 'data-code-annotation="' + annotation + '"'; 2032 const selector = 'span[' + cellAttr + '][' + lineAttr + ']'; 2033 return selector; 2034 } 2035 const selectCodeLines = (annoteEl) => { 2036 const doc = window.document; 2037 const targetCell = annoteEl.getAttribute("data-target-cell"); 2038 const targetAnnotation = annoteEl.getAttribute("data-target-annotation"); 2039 const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation)); 2040 const lines = annoteSpan.getAttribute("data-code-lines").split(","); 2041 const lineIds = lines.map((line) => { 2042 return targetCell + "-" + line; 2043 }) 2044 let top = null; 2045 let height = null; 2046 let parent = null; 2047 if (lineIds.length > 0) { 2048 //compute the position of the single el (top and bottom and make a div) 2049 const el = window.document.getElementById(lineIds[0]); 2050 top = el.offsetTop; 2051 height = el.offsetHeight; 2052 parent = el.parentElement.parentElement; 2053 if (lineIds.length > 1) { 2054 const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]); 2055 const bottom = lastEl.offsetTop + lastEl.offsetHeight; 2056 height = bottom - top; 2057 } 2058 if (top !== null && height !== null && parent !== null) { 2059 // cook up a div (if necessary) and position it 2060 let div = window.document.getElementById("code-annotation-line-highlight"); 2061 if (div === null) { 2062 div = window.document.createElement("div"); 2063 div.setAttribute("id", "code-annotation-line-highlight"); 2064 div.style.position = 'absolute'; 2065 parent.appendChild(div); 2066 } 2067 div.style.top = top - 2 + "px"; 2068 div.style.height = height + 4 + "px"; 2069 div.style.left = 0; 2070 let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter"); 2071 if (gutterDiv === null) { 2072 gutterDiv = window.document.createElement("div"); 2073 gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter"); 2074 gutterDiv.style.position = 'absolute'; 2075 const codeCell = window.document.getElementById(targetCell); 2076 const gutter = codeCell.querySelector('.code-annotation-gutter'); 2077 gutter.appendChild(gutterDiv); 2078 } 2079 gutterDiv.style.top = top - 2 + "px"; 2080 gutterDiv.style.height = height + 4 + "px"; 2081 } 2082 selectedAnnoteEl = annoteEl; 2083 } 2084 }; 2085 const unselectCodeLines = () => { 2086 const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"]; 2087 elementsIds.forEach((elId) => { 2088 const div = window.document.getElementById(elId); 2089 if (div) { 2090 div.remove(); 2091 } 2092 }); 2093 selectedAnnoteEl = undefined; 2094 }; 2095 // Handle positioning of the toggle 2096 window.addEventListener( 2097 "resize", 2098 throttle(() => { 2099 elRect = undefined; 2100 if (selectedAnnoteEl) { 2101 selectCodeLines(selectedAnnoteEl); 2102 } 2103 }, 10) 2104 ); 2105 function throttle(fn, ms) { 2106 let throttle = false;
2107 let timer; 2108 return (...args) => { 2109 if(!throttle) { // first call gets through 2110 fn.apply(this, args); 2111 throttle = true; 2112 } else { // all the others get throttled 2113 if(timer) clearTimeout(timer); // cancel #2 2114 timer = setTimeout(() => { 2115 fn.apply(this, args); 2116 timer = throttle = false; 2117 }, ms); 2118 } 2119 }; 2120 } 2121 const annoteTargets = window.document.querySelectorAll('.code-annotation-anchor'); 2122 for (let i=0; i<annoteTargets.length; i++) { 2123 const annoteTarget = annoteTargets[i]; 2124 const targetCell = annoteTarget.getAttribute("data-target-cell"); 2125 const targetAnnotation = annoteTarget.getAttribute("data-target-annotation"); 2126 const contentFn = () => { 2127 const content = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation)); 2128 if (content) { 2129 const tipContent = content.cloneNode(true); 2130 tipContent.classList.add("code-annotation-tip-content"); 2131 return tipContent.outerHTML; 2132 } 2133 } 2134 const config = { 2135 allowHTML: true, 2136 content: contentFn, 2137 onShow: (instance) => { 2138 selectCodeLines(instance.reference); 2139 instance.reference.classList.add('code-annotation-active'); 2140 window.tippy.hideAll(); 2141 }, 2142 onHide: (instance) => { 2143 unselectCodeLines(); 2144 instance.reference.classList.remove('code-annotation-active'); 2145 }, 2146 maxWidth: 300, 2147 delay: [50, 0], 2148 duration: [200, 0], 2149 offset: [5, 10], 2150 arrow: true, 2151 appendTo: function(el) { 2152 return el.parentElement.parentElement.parentElement; 2153 }, 2154 interactive: true, 2155 interactiveBorder: 10, 2156 theme: 'quarto', 2157 placement: 'right', 2158 popperOptions: { 2159 modifiers: [ 2160 { 2161 name: 'flip', 2162 options: { 2163 flipVariations: false, // true by default 2164 allowedAutoPlacements: ['right'], 2165 fallbackPlacements: ['right', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left'], 2166 }, 2167 }, 2168 { 2169 name: 'preventOverflow', 2170 options: { 2171 mainAxis: false, 2172 altAxis: false 2173 } 2174 } 2175 ] 2176 } 2177 }; 2178 window.tippy(annoteTarget, config); 2179 } 2180 const findCites = (el) => { 2181 const parentEl = el.parentElement; 2182 if (parentEl) { 2183 const cites = parentEl.dataset.cites; 2184 if (cites) { 2185 return { 2186 el, 2187 cites: cites.split(' ') 2188 }; 2189 } else { 2190 return findCites(el.parentElement) 2191 } 2192 } else { 2193 return undefined; 2194 } 2195 }; 2196 var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]'); 2197 for (var i=0; i<bibliorefs.length; i++) { 2198 const ref = bibliorefs[i]; 2199 const citeInfo = findCites(ref); 2200 if (citeInfo) { 2201 tippyHover(citeInfo.el, function() { 2202 var popup = window.document.createElement('div'); 2203 citeInfo.cites.forEach(function(cite) { 2204 var citeDiv = window.document.createElement('div'); 2205 citeDiv.classList.add('hanging-indent'); 2206 citeDiv.classList.add('csl-entry'); 2207 var biblioDiv = window.document.getElementById('ref-' + cite); 2208 if (biblioDiv) { 2209 citeDiv.innerHTML = biblioDiv.innerHTML; 2210 } 2211 popup.appendChild(citeDiv); 2212 }); 2213 return popup.innerHTML; 2214 }); 2215 } 2216 } 2217 }); 2218 </script>
2218 2219</div> <!-- /content --> 2220<footer class="footer"> 2221 <div class="nav-footer"> 2222 <div class="nav-footer-left"> 2223 2224 </div> 2225 <div class="nav-footer-center"> 2226 2227 <div class="toc-actions d-sm-block d-md-none"><ul><li><a href="https://github.com/ibis-project/ibis/edit/main/docs/tutorials/basics.qmd" class="toc-action"><i class="bi bi-github"></i>Edit this page</a></li><li><a href="https://github.com/ibis-project/ibis/issues/new/choose" class="toc-action"><i class="bi empty"></i>Report an issue</a></li></ul></div></div> 2228 <div class="nav-footer-right"> 2229 <ul class="footer-items list-unstyled"> 2230 <li class="nav-item compact"> 2231 <a class="nav-link" href="https://github.com/ibis-project"> 2232 <i class="bi bi-github" role="img"> 2233</i> 2234 </a> 2235 </li> 2236 <li class="nav-item compact"> 2237 <a class="nav-link" href="https://ibis-project.zulipchat.com"> 2238 <i class="bi bi-zulip" role="img"> 2239</i> 2240 </a> 2241 </li> 2242 <li class="nav-item compact"> 2243 <a class="nav-link" href="https://ibis-project.org/posts.xml"> 2244 <i class="bi bi-rss" role="img"> 2245</i> 2246 </a> 2247 </li> 2248</ul> 2249 </div> 2250 </div> 2251</footer> 2252 2253 2254 2255 2256</body></html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.