diff --git a/docs/user_guide/data_types_and_io/structureddataset.md b/docs/user_guide/data_types_and_io/structureddataset.md index e37c006d0e..6639d1b2a7 100644 --- a/docs/user_guide/data_types_and_io/structureddataset.md +++ b/docs/user_guide/data_types_and_io/structureddataset.md @@ -39,9 +39,22 @@ It offers the following benefits: (not only at compile time, but also runtime since type information is carried along in the literal), store third-party schema definitions, and potentially in the future, render sample data, provide summary statistics, etc. +## Usage + +To use the `StructuredDataset` type, import `pandas` and define a task that returns a Pandas Dataframe. +Flytekit will detect the Pandas DataFrame return signature and convert the interface for the task to +the {py:class}`StructuredDataset` type. + +## Example + This example demonstrates how to work with a structured dataset using Flyte entities. -To begin, import the necessary dependencies. +```{note} +To use the `StructuredDataset` type, you only need to import `pandas`. +The other imports specified below are only necessary for this specific example. +``` + +To begin, import the dependencies for the example: ```{code-cell} import os @@ -67,8 +80,6 @@ from typing_extensions import Annotated +++ {"lines_to_next_cell": 0} Define a task that returns a Pandas DataFrame. -Flytekit will detect the Pandas dataframe return signature and -convert the interface for the task to the new {py:class}`StructuredDataset` type. ```{code-cell} @task