Python SDK
fs.load()
SDK Reference: tabular ingestion
python
def load(source: object) -> Dataset:Load a supported local tabular file or in-memory DataFrame into a normalized immutable Dataset descriptor.
When to Use It
Use at the start of any data validation script or pipeline step to parse files or wrap DataFrames into a standard Dataset object containing inferred schemas, column data types, row counts, and source metadata.
Arguments
- source:
str|pandas.DataFrame|polars.DataFrame. Local file path (.csv,.xlsx,.xls,.parquet) or loaded DataFrame object.
Return Value
Returns a normalized, shallowly immutable Dataset dataclass containing dataframe, backend ("polars" or "pandas"), schema (DatasetSchema), row_count, column_count, dtypes, source, and file_size.
Exceptions
ConnectorError: Base exception raised when a data source cannot be validated or loaded.SourceNotFoundError: Raised when the target local file path does not exist.UnsupportedFormatError: Raised when the file extension or object type is unsupported.SourceParseError: Raised when parsing or reading the file content fails.
Example
python
import featuresmith as fsimport polars as pl# Load from local file path (CSV, Parquet, Excel)ds = fs.load("train.parquet")print(f"Loaded {ds.row_count} rows across {ds.column_count} columns via {ds.backend}.")# Load from in-memory Polars or pandas DataFramedf = pl.DataFrame({"x": [1, 2, 3], "y": [4.0, 5.0, 6.0]})ds_mem = fs.load(df)print(ds_mem.preview(2))Notes and Limitations
- Zero Data Copying: In-memory pandas or Polars DataFrames are wrapped directly without copying memory buffers.
- Backend Engines: Polars is used for CSV and Parquet files; pandas is used for Excel files.