Gridscript

Sample Rows

The Sample Rows tool allows you to extract a smaller, representative subset of your dataset for analysis, testing, or visualization. Instead of working with the entire dataset, you can generate a sample based on row counts or percentages, and choose from different statistical sampling methods.

Key Features

  • Modes – Choose between:
    • By Row Count: Specify an exact number of rows to sample.
    • By Percentage: Select a percentage of the dataset to sample.
  • Sampling Methods:
    • Random: Selects rows randomly across the dataset.
    • Systematic: Picks every k-th row (e.g., every 5th row).
    • Stratified: Divides the dataset into groups based on the first column (e.g., category or label) and samples evenly from each group.
  • Header preserved – The first row (header) is always kept at the top of the sampled dataset.
  • Error handling – Prevents invalid sample sizes (e.g., larger than available rows).

How to Use

  1. Open the Sample Rows dialog.
  2. Choose a sampling method (random, systematic, or stratified).
  3. Select a mode (by row count or by percentage).
  4. Enter the number of rows or percentage value.
  5. Click Sample – the dataset will be reduced to the sampled rows.
  6. Click Close to exit the dialog.

Examples

Original dataset (10 rows of data)

ID | Category | Value
-- | -------- | -----
1 | A | 100
2 | A | 120
3 | B | 90
4 | B | 95
5 | C | 80
6 | C | 85
7 | A | 110
8 | B | 105
9 | C | 70
10 | A | 115

Random, 30% sample → 3 rows randomly chosen.

Systematic, 3 rows → Every 3rd row is selected.

Stratified, 6 rows → 2 rows sampled evenly from each category (A, B, C).

Workspaces

Get familiar with Workspaces in Gridscript.

Charts

Learn how to visualize your data with Gridscript charts.