Implicit Transformation

At times the data transformations we wish to perform involve applying the same transformations to multiple columns. Implicit transformation allows us to succinctly apply one or more data transformation operations to a selected set of columns without having to spell out each transformation explicitly.

In its simplest form, a typical implicit data transformation expression looks like so:

df_n = df[['col_1', 'col_2']].apply([round, abs])

where we select the columns that we wish to transform and then use apply() to execute one or more data transformation operation on each of the selected columns.

This section is organized to cover the three aspects of Implicit data transformation as follows:

  1. Column Selection where we cover how to select the column(s) to each of which we will apply transformation operations.
  2. Function Specification where we cover how to specify the data transformation expressions or functions to apply to each of the selected columns.
  3. Output Naming where we cover how to specify the name(s) of output column(s) created by the implicit data transformation operations.

In addition, we show how implicit data transformation, i.e. applying one or more data transformation functions to a set of selected columns, can be extended to:

  1. Grouped Transformation where we cover how to apply one or more data transformation functions to a set of selected columns for each group in a grouped data frame.
  2. Conditional Transformation where we cover how to apply one or more data transformation functions to a set of selected columns conditionally based on the values of said columns.
  3. Non-Vectorized Transformation where we cover how to apply one or more data transformation functions to a set of selected columns one row at a time.
PYTHON
I/O