PandasToView
Experimental
The Workbench View classes are currently in experimental mode so have fun but expect issues and API changes going forward.
PandasToView creates a view by joining an artifact's source table with a Pandas DataFrame on an id column — handy for layering feature-engineered columns onto an existing DataSource or FeatureSet. It subclasses CreateView.
PandasToView Class: A View that joins the source_table with a Pandas dataframe
PandasToView
Bases: CreateView
PandasToView Class: A View that joins the source_table with a Pandas dataframe
Common Usage:
# Grab a DataSource
ds = DataSource("test_data")
# Do some awesome Feature Engineering :)
my_df = ds.pull_dataframe()
my_df["random1"] = np.random.rand(len(my_df))
my_df["random2"] = np.random.rand(len(my_df))
# Create your new View
fe_view = PandasToView.create("feature_engineering_view", ds, df=my_df, id_column="id")
# Query the view
df = fe_view.query(f"SELECT * FROM {fe_view.table} where residuals > 0.5")
Source code in src/workbench/core/views/pandas_to_view.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
create(view_name, artifact, df, id_column, source_table=None)
classmethod
Factory method to create and return a PandasToView instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_name
|
str
|
The name of the view |
required |
artifact
|
Union[DataSource, FeatureSet]
|
The DataSource or FeatureSet object |
required |
df
|
DataFrame
|
The Pandas DataFrame to join with the source_table |
required |
id_column
|
str
|
The name of the id column (must be defined for join logic) |
required |
source_table
|
str
|
The table/view to create the view from. Defaults to None |
None
|
Returns:
| Type | Description |
|---|---|
Union[View, None]
|
Union[View, None]: The created View object (or None if failed to create the view) |
Source code in src/workbench/core/views/pandas_to_view.py
Questions?

The SuperCowPowers team is happy to answer any questions you may have about AWS and Workbench. Please contact us at workbench@supercowpowers.com or on chat us up on Discord