idmd.manipulation.columns.ColumnManipulatorLogic

class idmd.manipulation.columns.ColumnManipulatorLogic[source]

Bases: object

Handles the logic for column operations and transformations.

Methods

drop_column

Drop a column from the DataFrame.

select_columns

Select specific columns to keep in the DataFrame.

swap_columns

Swap two columns in the DataFrame.

static drop_column(df, column)[source]

Drop a column from the DataFrame.

Return type:

DataFrame

Args:

df (pd.DataFrame): The DataFrame to modify. column (str): The column to drop.

Returns:

pd.DataFrame: The modified DataFrame without the dropped column.

static select_columns(df, columns)[source]

Select specific columns to keep in the DataFrame.

Return type:

DataFrame

Args:

df (pd.DataFrame): The DataFrame to modify. columns (List[str]): The list of columns to keep.

Returns:

pd.DataFrame: The modified DataFrame with only the selected columns.

static swap_columns(df, col1, col2)[source]

Swap two columns in the DataFrame.

Return type:

DataFrame

Args:

df (pd.DataFrame): The DataFrame to modify. col1 (str): The first column to swap. col2 (str): The second column to swap.

Returns:

pd.DataFrame: The modified DataFrame with swapped columns.