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 ofSampleobjects.
method __init__¶
__init__() → None
Class constructor method.
method append_df¶
append_df(df: DataFrame, **kwargs: Any) → None
Append dataframe to records.
Duplicate records and extra columns will be dropped.
Args:
df: PandasDataFrameobject.**kwargs: Keyword arguments to pass to_sanitize_df().
method append_obj¶
append_obj(samples: Sequence[Sample], **kwargs: Any) → None
Append samples to records.
Duplicate records and extra fields will be dropped.
Args:
samples: Sequence ofSampleobjects.**kwargs: Keyword arguments to pass toappend_df().
method update¶
update(
df: DataFrame,
by: Optional[str] = None,
overwrite: bool = False,
**kwargs: Any
) → None
Update records with dataframe.
Args:
df: PandasDataFrameobject.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 bybynot 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.