Featuresmith Icon
Featuresmith
  • Docs
  • SDK
  • CLI
  • Examples
  • Roadmap
v0.4.0
Documentation

Getting Started

  • Introduction
  • Installation
  • Quick Start
  • Tutorial Notebooks
  • Benchmarks
  • Development Setup
  • Contributing

Core Concepts

  • Architecture Overview
  • Dataset Layer
  • Connectors
  • Profiling Engine
  • Rule Engine
  • Dataset Review Engine
  • ML Readiness Score
  • Target Leakage Detection
  • Dataset Diff Engine
  • Target Column Concept
  • Mental Model & Workflow
  • Interpreting Findings
  • Workflow Cheat Sheet
  • Beginner Glossary

Python SDK

  • load()
  • profile()
  • analyze()
  • review()
  • diff()
  • score()
  • plan()
  • Dataset
  • Data Models
  • Profile Models
  • Rule & Finding Models
  • Review Models
  • Score Models
  • Leakage Models
  • Diff Models
  • Exceptions
  • Plugins

CLI Reference

  • analyze
  • review
  • diff
  • score
  • plan
  • Configuration

Guides

  • CI/CD Integration
  • Custom Rules
  • Writing Plugins

Resources

  • Release Notes
  • FAQ
  • Troubleshooting
DocsGuide

Getting Started

  • Introduction
  • Installation
  • Quick Start
  • Tutorial Notebooks
  • Benchmarks
  • Development Setup
  • Contributing

Core Concepts

  • Architecture Overview
  • Dataset Layer
  • Connectors
  • Profiling Engine
  • Rule Engine
  • Dataset Review Engine
  • ML Readiness Score
  • Target Leakage Detection
  • Dataset Diff Engine
  • Target Column Concept
  • Mental Model & Workflow
  • Interpreting Findings
  • Workflow Cheat Sheet
  • Beginner Glossary

Python SDK

  • load()
  • profile()
  • analyze()
  • review()
  • diff()
  • score()
  • plan()
  • Dataset
  • Data Models
  • Profile Models
  • Rule & Finding Models
  • Review Models
  • Score Models
  • Leakage Models
  • Diff Models
  • Exceptions
  • Plugins

CLI Reference

  • analyze
  • review
  • diff
  • score
  • plan
  • Configuration

Guides

  • CI/CD Integration
  • Custom Rules
  • Writing Plugins

Resources

  • Release Notes
  • FAQ
  • Troubleshooting
HomeDocsDataset

Python SDK

Dataset

SDK Reference: the normalized dataset model

A normalized, immutable view of a loaded tabular dataset. fs.load() returns a Dataset, and it is also what fs.profile(), fs.analyze(), and fs.review() accept as their primary input. The class is a frozen, slotted dataclass so every instance is read-only and safely serializable.

The Dataset type lives in featuresmith.core.dataset. It is not re-exported from the top-level featuresmith package, so import it explicitly:

python
1from featuresmith.core.dataset import Dataset

Dataclass Fields

python
1@dataclass(frozen=True, slots=True)
2class Dataset:
3 dataframe: Any # pandas or Polars dataframe (memory is not copied)
4 backend: str # "pandas" or "polars"
5 schema: DatasetSchema # columns: tuple[ColumnSchema(name, dtype), ...]
6 metadata: Mapping[str, object]
7 row_count: int # default 0
8 column_count: int # default 0
9 dtypes: Mapping[str, str] # column name -> backend dtype string
10 source: str | None # original local file path, if any (default None)
11 file_size: int | None # source file size in bytes, if known (default None)

In practice every field except dataframe, backend, and schema is computed for you during loading, so you normally construct a Dataset via fs.load() or Dataset.from_dataframe() rather than directly.

from_dataframe()

python
1@classmethod
2def from_dataframe(
3 cls,
4 dataframe: Any,
5 *,
6 backend: str,
7 source: str | None = None,
8 file_size: int | None = None,
9 metadata: Mapping[str, object] | None = None,
10) -> Dataset:

Creates a normalized dataset from a pandas or Polars dataframe, inferring the schema and dtype mapping. Used internally by the connectors; the public way to obtain a Dataset is fs.load().

preview(rows=5)

python
1def preview(self, rows: int = 5) -> Any:

Returns the first rows rows of the underlying dataframe (same backend as the source). Raises ValueError when rows is negative.

Example

python
1import featuresmith as fs
2
3dataset = fs.load("train.parquet")
4
5print(dataset.row_count) # number of rows
6print(dataset.column_count) # number of columns
7print(dataset.backend) # "pandas" or "polars"
8print(dataset.source) # original file path, if loaded from disk
9
10# Inspect the normalized schema and preview rows
11for column in dataset.schema.columns:
12 print(column.name, column.dtype)
13
14print(dataset.preview(5)) # first 5 rows as a dataframe

Explore

  • Quick Start
  • Python SDK
  • CLI Reference
  • Examples
Featuresmith Icon
Featuresmith

Open-source data profiling and validation for Python engineers.

Documentation

  • Introduction
  • Quick Start
  • Python SDK
  • CLI Reference

Community

  • GitHub
  • Discussions
  • Issues
  • Contributing

Project

  • Roadmap
  • Release status
  • Benchmarks
  • Changelog
  • Examples

Legal

  • Apache 2.0 License
  • Code of Conduct
  • Security

© 2026 Featuresmith Contributors. Released under the Apache 2.0 License.

Built by Aditya Gangwani in the open.