dqm_ml_job.dataloaders.pandas
Pandas data loader for reading CSV files.
This module contains the PandasDataLoader and PandasDataSelection classes for loading and iterating over CSV file data using Pandas.
logger = logging.getLogger(__name__)
module-attribute
PandasDataLoader
Data loader for CSV files using Pandas.
This loader reads CSV files and provides DataSelections for processing by the DQM pipeline.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
str
|
The loader type identifier ("csv"). |
Source code in packages/dqm-ml-job/src/dqm_ml_job/dataloaders/pandas.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
filesystem = None
instance-attribute
filters_dict = {}
instance-attribute
id_column = config.get('id_column')
instance-attribute
name = name
instance-attribute
path = config['path']
instance-attribute
sample_path = config.get('sample_path', [])
instance-attribute
split = SplitConfig.model_validate(split) if split else None
instance-attribute
split_by = self.split.by if self.split else None
instance-attribute
split_values = self.split.values if self.split else None
instance-attribute
transforms = config.get('transform', [])
instance-attribute
type: str = 'csv'
class-attribute
instance-attribute
__init__(name: str, config: dict[str, Any] | None = None)
Initialize the Pandas data loader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique name for this loader instance. |
required |
config
|
dict[str, Any] | None
|
Configuration dictionary containing: - path: Path to CSV file (required) |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If required config keys are missing. |
Source code in packages/dqm-ml-job/src/dqm_ml_job/dataloaders/pandas.py
get_selections() -> list[DataSelection]
Create one or more PandasDataSelection instances based on split config.
If split is configured, returns one selection per split value. Otherwise returns a single selection for the entire CSV file.
Returns:
| Type | Description |
|---|---|
list[DataSelection]
|
A list of DataSelection instances. |
Source code in packages/dqm-ml-job/src/dqm_ml_job/dataloaders/pandas.py
PandasDataSelection
Bases: DataSelection
A selection of data from a CSV file loaded via Pandas.
This class represents data loaded from a CSV file and provides an iterator over PyArrow RecordBatches.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
Name identifier for this selection. |
|
path |
Path to the CSV file. |
|
data |
DataFrame | None
|
The loaded pandas DataFrame. |
sample_path |
List of sample path configs describing column path prefixes. |
|
transforms |
List of transform configs (column cast operations). |
Source code in packages/dqm-ml-job/src/dqm_ml_job/dataloaders/pandas.py
data: pd.DataFrame | None = None
instance-attribute
filters_dict = filters_dict or {}
instance-attribute
name = name
instance-attribute
path = path
instance-attribute
sample_path = sample_path or []
instance-attribute
transforms = transforms or []
instance-attribute
__init__(name: str, path: str, sample_path: list[dict[str, Any]] | None = None, transforms: list[dict[str, Any]] | None = None, filters_dict: dict[str, Any] | None = None)
Initialize a Pandas data selection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name identifier for this selection. |
required |
path
|
str
|
Path to the CSV file. |
required |
sample_path
|
list[dict[str, Any]] | None
|
List of sample path configs describing column path prefixes. |
None
|
transforms
|
list[dict[str, Any]] | None
|
List of transform configs (column cast operations). |
None
|
filters_dict
|
dict[str, Any] | None
|
Column-value pairs to filter rows by. |
None
|
Source code in packages/dqm-ml-job/src/dqm_ml_job/dataloaders/pandas.py
__iter__() -> Any
__len__() -> int
__repr__() -> str
bootstrap(columns_list: list[str] | None = None) -> None
Load the CSV file into memory as a pandas DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
columns_list
|
list[str] | None
|
Unused, kept for API compatibility. |
None
|
Source code in packages/dqm-ml-job/src/dqm_ml_job/dataloaders/pandas.py
get_nb_batches() -> int
Return the estimated number of batches (always 1 for CSV).
Returns:
| Type | Description |
|---|---|
int
|
1 if data is loaded, 0 otherwise. |