random_selector

Select random subsets from CSV files by fixed number or proportion.

541|171|Updated May 3, 2018
One-click install
npx skills add https://github.com/cas-bigdatalab/piflow --skill random-selector
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: random_selector
Source: https://github.com/cas-bigdatalab/piflow/tree/main/workspace/skills/random_selector
Command: npx skills add https://github.com/cas-bigdatalab/piflow --skill random-selector

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill addresses the need for random sampling from CSV datasets, allowing users to select a subset of data based on either a fixed number or a percentage ratio.

Core Features & Use Cases

  • Flexible Sampling: Offers options to sample data either by a fixed number or a proportion of the total dataset.
  • Seed Option: Provides a seed for reproducible random sampling.
  • Use Case: Ideal for data preprocessing where you need a representative subset of data for model training or analysis.

Quick Start

Select a random sample from your dataset with a ratio of 0.3. Run the skill by executing: random_selector --input_file my_data.csv --output_file sampled_data.csv --select_ratio 0.3

Frequently Asked Questions about random_selector

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I randomly sample a subset of rows from a CSV file?

You can randomly sample a CSV subset by specifying either a fixed number of rows or a proportion ratio. This skill utilizes pandas to manipulate the data and outputs the selected subset to a new CSV file.

Can I get a reproducible random sample from my dataset?

Yes, reproducible random sampling is possible by providing a seed value. This ensures that the random number generator yields the exact same data subset every time the sampling process runs on your CSV file.

What is the best way to extract a representative data subset for model training?

Extracting a representative data subset for model training is best done by sampling a proportion of your total dataset. This skill allows you to specify a ratio like 0.3 to quickly generate a randomized subset for analysis.

Does this random sampling tool work with large CSV files?

Yes, it processes CSV files using pandas for data manipulation. You can extract either a fixed number of rows or a percentage ratio from your dataset to create a manageable subset for preprocessing.

How do I select a fixed number of random rows from a CSV?

To select a fixed number of random rows from a CSV, use the selection parameter to specify your desired count. The skill leverages pandas and numpy to extract that exact number of randomly chosen records.