module samples.sample_record_processor
¶
Interact with ZARP sample records.
Global Variables¶
- columns_model
class SampleRecordProcessor
¶
ZARP sample record processor class.
Defines methods to append and update sample records.
Attributes:
samples
: Sequence ofSample
objects.
method __init__
¶
__init__() → None
Class constructor method.
method append
¶
append(df: DataFrame, **kwargs: Any) → None
Append dataframe to records.
Duplicate records and extra columns will be dropped.
Args:
df
: PandasDataFrame
object.**kwargs
: Keyword arguments to pass to_sanitize_df()
.
method append_from_obj
¶
append_from_obj(samples: Sequence[Sample], **kwargs: Any) → None
Append samples to records.
Duplicate records and extra fields will be dropped.
Args:
samples
: Sequence ofSample
objects.**kwargs
: Keyword arguments to pass toappend()
.
method update
¶
update(
df: DataFrame,
by: Optional[str] = None,
overwrite: bool = False,
**kwargs: Any
) → None
Update records with dataframe.
Args:
df
: PandasDataFrame
object.by
: Column to use as index for update. IfNone
(default), compares database records by position.overwrite
: Overwrite existing records. IfFalse
(default), existing records will not be updated.**kwargs
: Keyword arguments to pass to_sanitize_df()
.
Raises:
KeyError
: Column indicated byby
not found in records or dataframe.ValueError
: Records and dataframe have different lengths/rows.
method view
¶
view(
level: int = 10,
rows: Optional[int] = None,
columns: Optional[int] = None,
width: Optional[int] = None
) → None
Show records.
Args:
level
: Logging level to use.rows
: Number of rows to show.columns
: Number of columns to show.width
: Maximum column width.