pat2vec.pat2vec_search.data_helper_functions
Functions
|
Calculates current age and appends it as a new 'age' column. |
|
Calculates age at the time of record and appends it as 'ageAtRecord'. |
|
Calculates age at record time for a single row (passed as a Series). |
Ensures all column names in a DataFrame are unique. |
- pat2vec.pat2vec_search.data_helper_functions.appendAge(dataFrame)[source]
Calculates current age and appends it as a new ‘age’ column.
- Parameters:
dataFrame (
DataFrame
) – A DataFrame containing a ‘client_dob’ column with date of birth strings.- Return type:
DataFrame
- Returns:
The DataFrame with an added ‘age’ column.
- pat2vec.pat2vec_search.data_helper_functions.appendAgeAtRecord(dataFrame)[source]
Calculates age at the time of record and appends it as ‘ageAtRecord’.
- Parameters:
dataFrame (
DataFrame
) – A DataFrame with ‘client_dob’ and ‘updatetime’ columns.- Return type:
DataFrame
- Returns:
The DataFrame with an added ‘ageAtRecord’ column.
- pat2vec.pat2vec_search.data_helper_functions.append_age_at_record_series(series)[source]
Calculates age at record time for a single row (passed as a Series).
- Parameters:
series (
Series
) – A pandas Series representing a single row, containing ‘client_dob’ and ‘updatetime’.- Return type:
Series
- Returns:
The input Series with an added ‘age’ value.
- pat2vec.pat2vec_search.data_helper_functions.df_column_uniquify(df)[source]
Ensures all column names in a DataFrame are unique.
If duplicate column names are found, they are made unique by appending a suffix (e.g., ‘col_1’, ‘col_2’).
- Parameters:
df (
DataFrame
) – The DataFrame to process.- Return type:
DataFrame
- Returns:
The DataFrame with unique column names.