AutoDataPrep with Skipping Data Preparation Phase - Example 3: AutoDataPrep with Skipping Data Preparation Phase - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Teradata Package for Python
Release Number
20.00
Published
March 2025
ft:locale
en-US
ft:lastEdition
2026-08-13
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage
This example prepares Titanic passenger data for classification by skipping the Data Preparation phase to get clean data for further analysis.
Run AutoDataprep to get the optimized data with the following specifications:
  • Set task_type to Classification.
  • Set the verbose level to 2 to obtain detailed information about intermediate steps.
  • Set skip_phases to Data_Preparation.
  1. Load the titanic dataset.
    >>> load_example_data("teradataml", "titanic")
  2. Create the DataFrame.
    >>> titanic = DataFrame.from_table("titanic")
  3. Create an instance of AutoDataPrep.
    >>> acls = AutoDataPrep(task_type="Classification", verbose=2, 
                                     skip_phases=["Data_Preparation"])
  4. Fit the data.
    >>> acls.fit(titanic, titanic.survived)
    1. Feature Exploration -> 2. Feature Engineering__________________________________| 0% - 0/6
    2026-04-07 03:33:05,577 | INFO     | Feature Exploration started
    2026-04-07 03:33:05,578 | INFO     | Data Overview:
    2026-04-07 03:33:05,620 | INFO     | Total Rows in the data: 891
    2026-04-07 03:33:05,621 | INFO     | Total Columns in the data: 12
    2026-04-07 03:33:07,149 | INFO     | Column Summary:
       ColumnName                           Datatype  NonNullCount  NullCount  BlankCount  ZeroCount  PositiveCount  NegativeCount  NullPercentage  NonNullPercentage
    0         age                            INTEGER           714        177         NaN        7.0          707.0            0.0       19.865320          80.134680
    1        fare                              FLOAT           891          0         NaN       15.0          876.0            0.0        0.000000         100.000000
    2    embarked    VARCHAR(20) CHARACTER SET LATIN           889          2         0.0        NaN            NaN            NaN        0.224467          99.775533
    3         sex    VARCHAR(20) CHARACTER SET LATIN           891          0         0.0        NaN            NaN            NaN        0.000000         100.000000
    4        name  VARCHAR(1000) CHARACTER SET LATIN           891          0         0.0        NaN            NaN            NaN        0.000000         100.000000
    5       sibsp                            INTEGER           891          0         NaN      608.0          283.0            0.0        0.000000         100.000000
    6   passenger                            INTEGER           891          0         NaN        0.0          891.0            0.0        0.000000         100.000000
    7       cabin    VARCHAR(20) CHARACTER SET LATIN           204        687         0.0        NaN            NaN            NaN       77.104377          22.895623
    8       parch                            INTEGER           891          0         NaN      678.0          213.0            0.0        0.000000         100.000000
    9      ticket    VARCHAR(20) CHARACTER SET LATIN           891          0         0.0        NaN            NaN            NaN        0.000000         100.000000
    10     pclass                            INTEGER           891          0         NaN        0.0          891.0            0.0        0.000000         100.000000
    11   survived                            INTEGER           891          0         NaN      549.0          342.0            0.0        0.000000         100.000000
    2026-04-07 03:33:08,579 | INFO     | Statistics of Data:
      ATTRIBUTE            StatName   StatValue
    0       age             MAXIMUM   80.000000
    1       age  STANDARD DEVIATION   14.536483
    2       age     PERCENTILES(25)   20.000000
    3       age     PERCENTILES(50)   28.000000
    4      fare               COUNT  891.000000
    5      fare             MINIMUM    0.000000
    6      fare             MAXIMUM  512.329200
    7      fare                MEAN   32.204208
    8      fare  STANDARD DEVIATION   49.693429
    9      fare     PERCENTILES(25)    7.910400
    2026-04-07 03:33:08,728 | INFO     | Categorical Columns with their Distinct values:
    ColumnName                DistinctValueCount
    cabin                     147
    embarked                  3
    name                      891
    sex                       2
    ticket                    681
    2026-04-07 03:33:09,886 | INFO     | Futile columns in dataset:
      ColumnName
    0       name
    1     ticket
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              2026-04-07 03:33:12,237 | INFO     | Columns with outlier percentage :-
      ColumnName  OutlierPercentage
    0      sibsp           5.162738
    1      parch          23.905724
    2       fare          13.019080
    3        age          20.763187
     1. Feature Exploration -> 2. Feature Engineering
    2026-04-07 03:33:12,424 | INFO     | Feature Engineering started ...
    2026-04-07 03:33:12,425 | INFO     | Handling duplicate records present in dataset ...
    2026-04-07 03:33:12,547 | INFO     | Analysis completed. No action taken.
    2026-04-07 03:33:12,547 | INFO     | Total time to handle duplicate records: 0.12 sec
    2026-04-07 03:33:12,548 | INFO     | Handling less significant features from data ...
    2026-04-07 03:33:13,390 | INFO     | Removing Futile columns:
    ['ticket', 'name']
    2026-04-07 03:33:13,391 | INFO     | Sample of Data after removing Futile columns:
       passenger  survived  pclass     sex   age  sibsp  parch      fare cabin embarked  automl_id
    0        122         0       3    male   NaN      0      0    8.0500  None        S         11
    1         40         1       3  female  14.0      1      0   11.2417  None        C         10
    2        631         1       1    male  80.0      0      0   30.0000   A23        S         18
    3        570         1       3    male  32.0      0      0    7.8542  None        S         15
    4        326         1       1  female  36.0      0      0  135.6333   C32        C         13
    5        305         0       3    male   NaN      0      0    8.0500  None        S         21
    6        734         0       2    male  23.0      0      0   13.0000  None        S         14
    7         61         0       3    male  22.0      0      0    7.2292  None        C         22
    8        469         0       3    male   NaN      0      0    7.7250  None        Q          8
    9        183         0       3    male   9.0      4      2   31.3875  None        S         16
    891 rows X 11 columns
    2026-04-07 03:33:13,672 | INFO     | Total time to handle less significant features: 1.12 sec
    2026-04-07 03:33:13,672 | INFO     | Handling Date Features ...
    2026-04-07 03:33:13,672 | INFO     | Analysis Completed. Dataset does not contain any feature related to dates. No action needed.
    2026-04-07 03:33:13,672 | INFO     | Total time to handle date features: 0.00 sec
    2026-04-07 03:33:13,673 | INFO     | Checking Missing values in dataset ...
    2026-04-07 03:33:13,853 | INFO     | Columns with their missing values:
    embarked: 2
    cabin: 687
    age: 177
    2026-04-07 03:33:14,499 | INFO     | Deleting rows of these columns for handling missing values:
    ['embarked']
    2026-04-07 03:33:14,643 | INFO     | Sample of dataset after removing 2 rows:
       passenger  survived  pclass     sex   age  sibsp  parch      fare cabin embarked  automl_id
    0         80         1       3  female  30.0      0      0   12.4750  None        S         12
    1        122         0       3    male   NaN      0      0    8.0500  None        S         11
    2        591         0       3    male  35.0      0      0    7.1250  None        S         19
    3         40         1       3  female  14.0      1      0   11.2417  None        C         10
    4        265         0       3  female   NaN      0      0    7.7500  None        Q          9
    5        530         0       2    male  23.0      2      1   11.5000  None        S         17
    6        326         1       1  female  36.0      0      0  135.6333   C32        C         13
    7        305         0       3    male   NaN      0      0    8.0500  None        S         21
    8        734         0       2    male  23.0      0      0   13.0000  None        S         14
    9         61         0       3    male  22.0      0      0    7.2292  None        C         22
    889 rows X 11 columns
    2026-04-07 03:33:14,932 | INFO     | Dropping these columns for handling missing values:
    ['cabin']
    2026-04-07 03:33:14,932 | INFO     | Sample of dataset after removing 1 columns:
       passenger  survived  pclass     sex   age  sibsp  parch      fare embarked  automl_id
    0        122         0       3    male   NaN      0      0    8.0500        S         11
    1        734         0       2    male  23.0      0      0   13.0000        S         14
    2         61         0       3    male  22.0      0      0    7.2292        C         22
    3         40         1       3  female  14.0      1      0   11.2417        C         10
    4         80         1       3  female  30.0      0      0   12.4750        S         12
    5        345         0       2    male  36.0      0      0   13.0000        S         20
    6        326         1       1  female  36.0      0      0  135.6333        C         13
    7        305         0       3    male   NaN      0      0    8.0500        S         21
    8        265         0       3  female   NaN      0      0    7.7500        Q          9
    9        530         0       2    male  23.0      2      1   11.5000        S         17
    889 rows X 10 columns
    2026-04-07 03:33:15,307 | INFO     | Total time to find missing values in data: 1.63 sec
    2026-04-07 03:33:15,308 | INFO     | Imputing Missing Values ...
    2026-04-07 03:33:15,549 | INFO     | Columns with their imputation method:
    age: mean
    2026-04-07 03:33:16,923 | INFO     | Sample of dataset after Imputation:
       passenger  survived  pclass     sex  age  sibsp  parch      fare embarked  automl_id
    0        122         0       3    male   29      0      0    8.0500        S         11
    1        734         0       2    male   23      0      0   13.0000        S         14
    2         61         0       3    male   22      0      0    7.2292        C         22
    3        326         1       1  female   36      0      0  135.6333        C         13
    4        570         1       3    male   32      0      0    7.8542        S         15
    5        835         0       3    male   18      0      0    8.3000        S         23
    6         80         1       3  female   30      0      0   12.4750        S         12
    7        345         0       2    male   36      0      0   13.0000        S         20
    8        265         0       3  female   29      0      0    7.7500        Q          9
    9        530         0       2    male   23      2      1   11.5000        S         17
    889 rows X 10 columns
    2026-04-07 03:33:17,503 | INFO     | Time taken to perform imputation: 2.19 sec
    2026-04-07 03:33:17,504 | INFO     | Performing encoding for categorical columns ...
    2026-04-07 03:33:22,090 | INFO     | ONE HOT Encoding these Columns:
    ['sex', 'embarked']
    2026-04-07 03:33:22,090 | INFO     | Sample of dataset after performing one hot encoding:
               survived  pclass  sex_0  sex_1  age  sibsp  parch    fare  embarked_0  embarked_1  embarked_2  automl_id
    passenger
    387               0       3      0      1    1      5      2  46.900           0           0           1         27
    448               1       1      0      1   34      0      0  26.550           0           0           1         43
    713               1       1      0      1   48      1      0  52.000           0           0           1         51
    19                0       3      1      0   31      1      0  18.000           0           0           1         59
    59                1       2      1      0    5      1      2  27.750           0           0           1         75
    324               1       2      1      0   22      1      1  29.000           0           0           1         83
    263               0       1      0      1   52      1      1  79.650           0           0           1         67
    856               1       3      1      0   18      0      1   9.350           0           0           1         35
    591               0       3      0      1   35      0      0   7.125           0           0           1         19
    122               0       3      0      1   29      0      0   8.050           0           0           1         11
    889 rows X 13 columns
    2026-04-07 03:33:22,187 | INFO     | Time taken to encode the columns: 4.68 sec
    2026-04-07 03:33:22,187 | INFO     | Skipping Data_Preparation phase as requested./6
  5. Retrieve the data.
    >>> datas = acls.get_data()
    >>> print(datas)
    {'feature_engineering_output':            survived  pclass  sex_0  sex_1  age  sibsp  parch    fare  embarked_0  embarked_1  embarked_2  automl_id
     passenger
     387               0       3      0      1    1      5      2  46.900           0           0           1         27
     448               1       1      0      1   34      0      0  26.550           0           0           1         43
     713               1       1      0      1   48      1      0  52.000           0           0           1         51
     19                0       3      1      0   31      1      0  18.000           0           0           1         59
     59                1       2      1      0    5      1      2  27.750           0           0           1         75
     324               1       2      1      0   22      1      1  29.000           0           0           1         83
     263               0       1      0      1   52      1      1  79.650           0           0           1         67
     856               1       3      1      0   18      0      1   9.350           0           0           1         35
     591               0       3      0      1   35      0      0   7.125           0           0           1         19
     122               0       3      0      1   29      0      0   8.050           0           0           1         11}
  6. Delete the deployed data.
    Deletion of data can be partial or complete.
    • Partial delete using fs_method:
      >>> adp.delete_data(table_name='titanic_deploy', fs_method='pca')
      
      Removed pca_train table successfully.
    • Remove all data (complete):
      >>> adp.delete_data(table_name='titanic_deploy')
      Removed lasso_train table successfully.
      Removed rfe_train table successfully.
      Deployed data removed successfully.