view(df, limit: int = None)

The view function provides an easy way to display a dataset as a table or visualization, making it simple to explore and understand your data.

Parameters

  • df (Pandas DataFrame): The dataset you want to display. This must be a Pandas DataFrame.
  • limit (int, optional): The maximum number of rows to display. If not specified, the entire dataset will be displayed (depending on the environment).
  • size (float): (Optional) The width of the component in a row. Defaults to 1.0 (full row). See the Layout Guide for details.

Usage Example

Here’s an example of how to use the view function:

from preswald import view

# Example DataFrame
import pandas as pd

data = {
    "Name": ["Alice", "Bob", "Charlie"],
    "Age": [25, 30, 35],
    "City": ["New York", "Los Angeles", "Chicago"]
}

df = pd.DataFrame(data)

# Display the first 10 rows of the dataset
view(df, limit=10)

Key Features

  1. Dynamic Table Views: Automatically formats your dataset into a visually appealing table.
  2. Row Limiting: Use the limit parameter to control the number of rows displayed, useful for large datasets.
  3. Interactive Exploration: In supported environments, interact with the data directly, such as sorting or filtering.

Use view to turn raw data into clear, actionable insights! 🚀