Pandas
zenml.integrations.pandas
Initialization of the Pandas integration.
Attributes
PANDAS = 'pandas'
module-attribute
Classes
Integration
Base class for integration in ZenML.
Functions
activate() -> None
classmethod
Abstract method to activate the integration.
Source code in src/zenml/integrations/integration.py
175 176 177 |
|
check_installation() -> bool
classmethod
Method to check whether the required packages are installed.
Returns:
Type | Description |
---|---|
bool
|
True if all required packages are installed, False otherwise. |
Source code in src/zenml/integrations/integration.py
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 |
|
flavors() -> List[Type[Flavor]]
classmethod
Abstract method to declare new stack component flavors.
Returns:
Type | Description |
---|---|
List[Type[Flavor]]
|
A list of new stack component flavors. |
Source code in src/zenml/integrations/integration.py
179 180 181 182 183 184 185 186 |
|
get_requirements(target_os: Optional[str] = None, python_version: Optional[str] = None) -> List[str]
classmethod
Method to get the requirements for the integration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_os
|
Optional[str]
|
The target operating system to get the requirements for. |
None
|
python_version
|
Optional[str]
|
The Python version to use for the requirements. |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
A list of requirements. |
Source code in src/zenml/integrations/integration.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
get_uninstall_requirements(target_os: Optional[str] = None) -> List[str]
classmethod
Method to get the uninstall requirements for the integration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_os
|
Optional[str]
|
The target operating system to get the requirements for. |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
A list of requirements. |
Source code in src/zenml/integrations/integration.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
plugin_flavors() -> List[Type[BasePluginFlavor]]
classmethod
Abstract method to declare new plugin flavors.
Returns:
Type | Description |
---|---|
List[Type[BasePluginFlavor]]
|
A list of new plugin flavors. |
Source code in src/zenml/integrations/integration.py
188 189 190 191 192 193 194 195 |
|
PandasIntegration
Bases: Integration
Definition of Pandas integration for ZenML.
Functions
activate() -> None
classmethod
Activates the integration.
Source code in src/zenml/integrations/pandas/__init__.py
26 27 28 29 |
|
Modules
materializers
Initialization of the Pandas materializer.
Classes
Modules
pandas_materializer
Materializer for Pandas.
This materializer handles pandas DataFrame and Series objects.
Environment Variables
ZENML_PANDAS_SAMPLE_ROWS: Controls the number of sample rows to include in visualizations. Defaults to 10 if not set.
PandasMaterializer(uri: str, artifact_store: Optional[BaseArtifactStore] = None)
Bases: BaseMaterializer
Materializer to read data to and from pandas.
Define self.data_path
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uri
|
str
|
The URI where the artifact data is stored. |
required |
artifact_store
|
Optional[BaseArtifactStore]
|
The artifact store where the artifact data is stored. |
None
|
Source code in src/zenml/integrations/pandas/materializers/pandas_materializer.py
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 |
|
extract_metadata(df: Union[pd.DataFrame, pd.Series]) -> Dict[str, MetadataType]
Extract metadata from the given pandas dataframe or series.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df
|
Union[DataFrame, Series]
|
The pandas dataframe or series to extract metadata from. |
required |
Returns:
Type | Description |
---|---|
Dict[str, MetadataType]
|
The extracted metadata as a dictionary. |
Source code in src/zenml/integrations/pandas/materializers/pandas_materializer.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
load(data_type: Type[Any]) -> Union[pd.DataFrame, pd.Series]
Reads pd.DataFrame
or pd.Series
from a .parquet
or .csv
file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_type
|
Type[Any]
|
The type of the data to read. |
required |
Raises:
Type | Description |
---|---|
ImportError
|
If pyarrow or fastparquet is not installed. |
Returns:
Type | Description |
---|---|
Union[DataFrame, Series]
|
The pandas dataframe or series. |
Source code in src/zenml/integrations/pandas/materializers/pandas_materializer.py
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 |
|
save(df: Union[pd.DataFrame, pd.Series]) -> None
Writes a pandas dataframe or series to the specified filename.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df
|
Union[DataFrame, Series]
|
The pandas dataframe or series to write. |
required |
Source code in src/zenml/integrations/pandas/materializers/pandas_materializer.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|
save_visualizations(df: Union[pd.DataFrame, pd.Series]) -> Dict[str, VisualizationType]
Save visualizations of the given pandas dataframe or series.
Creates two visualizations: 1. A statistical description of the data (using df.describe()) 2. A sample of the data (first N rows controlled by ZENML_PANDAS_SAMPLE_ROWS)
Note
The number of sample rows shown can be controlled with the ZENML_PANDAS_SAMPLE_ROWS environment variable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df
|
Union[DataFrame, Series]
|
The pandas dataframe or series to visualize. |
required |
Returns:
Type | Description |
---|---|
Dict[str, VisualizationType]
|
A dictionary of visualization URIs and their types. |
Source code in src/zenml/integrations/pandas/materializers/pandas_materializer.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|