Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for preview datasets in Kedro-viz #2773

Merged
merged 17 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
1 change: 1 addition & 0 deletions docs/source/visualisation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ pip install kedro-viz
:maxdepth: 1

kedro-viz_visualisation
preview_datasets
visualise_charts_with_plotly
```
81 changes: 81 additions & 0 deletions docs/source/visualisation/preview_datasets.md
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 the preview of these datasets, you need to add the `preview_args` attribute to the `kedro-viz` configuration under the `metadata` section in the Data Catalog:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also state that nrow is number of rows to be previewed?


```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)