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
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
|