gators.transformers.TransformerXY¶
-
class
gators.transformers.
TransformerXY
[source]¶ Abstract gators transformer class to transform both X and y.
Examples
>>> from gators.transformers import TransformerXY >>> class FirsRows(TransformerXY): ... def transform(self, X, y): ... return X.head(1), y.head(1)
transform with pandas
>>> import pandas as pd >>> X, y = FirsRows().transform( ... X=pd.DataFrame({'A':[1, 2], 'B':[3, 4]}), ... y=pd.Series([0, 1],name='TARGET')) >>> X A B 0 1 3 >>> y 0 0 Name: TARGET, dtype: int64
transform with koalas
>>> import databricks.koalas as ks >>> X, y = FirsRows().transform( ... X=ks.DataFrame({'A':[1, 2], 'B':[3, 4]}), ... y=ks.Series([0, 1],name='TARGET')) >>> X A B 0 1 3 >>> y 0 0 Name: TARGET, dtype: int64
-
abstract
transform
(X: Union[pd.DataFrame, ks.DataFrame, dd.DataFrame], y: Union[pd.Series, ks.Series, dd.Series])[source]¶ Fit and Transform the dataframes X`ad `y.
- Parameters
- XDataFrame.
Input dataframe.
- ySeries
None.
- Returns
- Tuple[DataFrame, Series]
Transformed dataframes.