-
Notifications
You must be signed in to change notification settings - Fork 901
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for preview datasets in Kedro-viz (#2773)
Add documentation for preview datasets in Kedro-viz
- Loading branch information
1 parent
7916d86
commit b1e3293
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,6 @@ pip install kedro-viz | |
:maxdepth: 1 | ||
kedro-viz_visualisation | ||
preview_datasets | ||
visualise_charts_with_plotly | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Preview data in Kedro-Viz | ||
|
||
This page describes how to preview data from different datasets in a Kedro project with Kedro-Viz. Dataset preview was introduced in Kedro-Viz version 6.3.0, which offers preview for `CSVDatasets` and `ExcelDatasets`. | ||
|
||
We use the [spaceflights tutorial](../tutorial/spaceflights_tutorial.md) to demonstrate how to add data preview for the `customer`, `shuttle` and `reviews` datasets. Even if you have not yet worked through the tutorial, you can still follow this example; you'll need to use the [Kedro starter for the spaceflights tutorial](https://github.com/kedro-org/kedro-starters/tree/main/spaceflights) to generate a copy of the project with working code in place. | ||
|
||
If you haven't installed Kedro [follow the documentation to get set up](../get_started/install.md). | ||
|
||
Then, in your terminal window, navigate to the folder you want to store the project. | ||
|
||
Generate a copy of the spaceflights tutorial project with all the code in place by using the [Kedro starter for the spaceflights tutorial](https://github.com/kedro-org/kedro-starters/tree/main/spaceflights): | ||
|
||
```bash | ||
kedro new --starter=spaceflights | ||
``` | ||
|
||
When prompted for a project name, you can enter anything, but we will assume `Spaceflights` throughout. | ||
|
||
When your project is ready, navigate to the root directory of the project. | ||
|
||
## Configure the Data Catalog | ||
|
||
Kedro-Viz version 6.3.0 currently supports preview of two types of datasets: | ||
|
||
* `pandas.CSVDataset` | ||
* `pandas.ExcelDataset` | ||
|
||
|
||
To enable dataset preview, add the `preview_args` attribute to the kedro-viz configuration under the `metadata` section in the Data Catalog. Within preview_args, specify `nrows` as the number of rows to preview for the dataset. | ||
|
||
```yaml | ||
companies: | ||
type: pandas.CSVDataSet | ||
filepath: data/01_raw/companies.csv | ||
metadata: | ||
kedro-viz: | ||
layer: raw | ||
preview_args: | ||
nrows: 5 | ||
|
||
reviews: | ||
type: pandas.CSVDataSet | ||
filepath: data/01_raw/reviews.csv | ||
metadata: | ||
kedro-viz: | ||
layer: raw | ||
preview_args: | ||
nrows: 10 | ||
|
||
shuttles: | ||
type: pandas.ExcelDataSet | ||
filepath: data/01_raw/shuttles.xlsx | ||
metadata: | ||
kedro-viz: | ||
layer: raw | ||
preview_args: | ||
nrows: 15 | ||
``` | ||
## Previewing Data on Kedro-viz | ||
After you've configured the Data Catalog, you can preview the datasets on Kedro-Viz. Start Kedro-Viz by running the following command in your terminal: | ||
```bash | ||
kedro viz | ||
``` | ||
|
||
The previews are shown as follows: | ||
|
||
Click on each dataset node to see a small preview in the metadata panel: | ||
|
||
|
||
![](../meta/images/preview_datasets_metadata.png) | ||
|
||
|
||
View the larger preview of the dataset by clicking the `Expand Preview Table` button on the bottom of the metadata panel. | ||
|
||
|
||
![](../meta/images/preview_datasets_expanded.png) |