patient_to_df
Converts a Patient instance into a DataFrame suitable for prediction.
This function takes a Patient dataclass instance and flattens its attributes
along with nested Tooth and Side instances to generate a DataFrame. Each row
in the DataFrame corresponds to a side of a tooth, with all relevant patient,
tooth, and side attributes in a single row.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
patient
|
Patient
|
The Patient dataclass instance. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: DataFrame where each row represents a tooth side. |
Example
patient = Patient(..)
patient_data = patient_to_df(patient=patient)
Source code in periomod/base.py
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | |