Final adjustments

This commit is contained in:
José Valim 2023-03-20 13:36:31 +01:00
parent 8acec75d23
commit ec713f6d40
3 changed files with 42 additions and 16 deletions

View file

@ -9,26 +9,41 @@ Mix.install([
## Introduction
KinoExplorer makes it intuitive to build data transform pipelines by seamlessly integrating Explorer and Livebook.
To work with it in Livebook we need two libraries:
To explore and transform data in Livebook we need two libraries:
* The [`explorer`](https://github.com/elixir-nx/explorer)
package brings series (one-dimensional) and dataframes (two-dimensional) for fast data exploration to Elixir.
package brings series (one-dimensional) and dataframes (two-dimensional)
for fast data exploration to Elixir.
* The [`kino_explorer`](https://github.com/livebook-dev/kino_explorer) package automatically renders an `Explorer.DataFrame` or `Explorer.Series` as a data table.
* The [`kino_explorer`](https://github.com/livebook-dev/kino_explorer)
package automatically renders an `Explorer.DataFrame` or `Explorer.Series`
as a data table.
We will make extensive use of `Explorer.DataFrame`'s functions, so it's handy to alias the module to something shorter. We also need to [`require`](https://hexdocs.pm/elixir/Kernel.SpecialForms.html#require/2) the `Explorer.DataFrame` module to be able to use the [`Explorer.Query`](https://hexdocs.pm/explorer/Explorer.Query.html#content) module and the Data transform smart cell.
We will make extensive use of `Explorer.DataFrame`'s functions, so it's handy
to alias the module to something shorter. We will also
[`require`](https://hexdocs.pm/elixir/Kernel.SpecialForms.html#require/2)
the `Explorer.DataFrame` module to use its
[querying facilities](https://hexdocs.pm/explorer/Explorer.Query.html#content):
```elixir
alias Explorer.DataFrame, as: DF
require Explorer.DataFrame
```
All set, let's go.
## Quick introduction to Explorer and DataTable
Shortly, Explorer is the DataFrame library for Elixir. It brings the essential data analysis, exploration, and transformation tools to the Elixir ecosystem, while the integration provided by KinoExplorer makes it effortless to visualize and interact with data through the DataTable.
Shortly, Explorer is the DataFrame library for Elixir. It brings the
essential data analysis, exploration, and transformation tools to the
Elixir ecosystem, while the integration provided by KinoExplorer makes
it effortless to visualize and interact with data through the DataTable.
The DataTable offers a variety of features to make viewing data more convenient. You can easily select cells, columns or even the entire table, switch between paging and infinite scrolling, sort the columns or search for specific data. [Keyboard shortcuts](#shortcuts), including copy selection, are also available.
The DataTable offers a variety of features to make viewing data more
convenient. You can easily select cells, columns or even the entire table,
switch between paging and infinite scrolling, sort the columns or search
for specific data. [Keyboard shortcuts](#shortcuts), including copy
selection, are also available. Let's render a DataFrame to see an example:
```elixir
Explorer.Datasets.fossil_fuels()
@ -40,7 +55,9 @@ Explorer.Datasets.fossil_fuels()
## The Data transform smart cell
The DataTable let us to quickly view the raw data, without modifying it, while the Data transform cell allows us to transform it creating insightful and flexible data pipelines and seeing the results on the fly.
The DataTable let us to quickly view the raw data, without modifying it,
while the Data transform cell allows us to transform it creating insightful
and flexible data pipelines and seeing the results on the fly.
Before we explore its features, we need some data to work with.
@ -75,17 +92,26 @@ weekdays =
|> DF.pivot_wider("team", "hour")
```
Let's break down what happened in the previous Data transform cell to understand its capabilities.
Let's break down what happened in the previous Data transform cell.
Currently, the Data transform cell supports 4 operations: `sorting`, `filter`, `fill_missing` and `pivot_wider`. Each operation has its own colored card and you can move the cards to reorder the operations and see the changes in real time.
Currently, the Data transform cell supports several operations, such as `sorting`,
`filter`, `pivot_wider`, and more. Each operation has its own colored card and
you can move the cards to reorder the operations and see the changes in real time.
Except for `pivot_wider`, you can have multiple operations of any type. If two similar operations are in a row, they are grouped, and a single operation is generated for them in the code. However, you still have individual control over each.
Except for `pivot_wider`, you can have multiple operations of any type. If two
similar operations are in a row, they are grouped, and a single query command is
generated for them in the code. However, you still have individual control over each.
You can also use the toggle button to enable/disable the operations. This is particularly useful for seeing the implications of each step in your pipeline without having to rewrite it.
You can also use the toggle button to enable/disable the operations. This is
particularly useful for seeing the implications of each step in your pipeline
without having to rewrite it.
The initial state is purely a suggestion. You can easily add and remove operations to get the pipeline that meets your needs.
The initial state is purely a suggestion. You can easily add and remove operations
to get the pipeline that meets your needs.
Finally, the `assign to` field allows you to save the resulting DataFrame in a variable for later use in the notebook or in conjunction with other Smart Cells. For example, to plot a chart using the Chart cell!
Finally, the `assign to` field allows you to save the resulting DataFrame in a
variable for later use in the notebook or in conjunction with other Smart Cells.
For example, to plot a chart using the Chart cell.
## Shortcuts

View file

@ -1,4 +1,4 @@
# A look into built-in Kinos
# Exploring built-in Kinos
```elixir
Mix.install([

View file

@ -1,4 +1,4 @@
# Exploring Smart cells
# Automating with Smart cells
```elixir
Mix.install([