-
Notifications
You must be signed in to change notification settings - Fork 883
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nate Parsons
committed
Oct 25, 2023
1 parent
d11ee45
commit f0a5812
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
featuretools/tests/primitive_tests/aggregation_primitive_tests/test_percent_true.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import pandas as pd | ||
from woodwork.logical_types import BooleanNullable | ||
|
||
import featuretools as ft | ||
|
||
|
||
def test_percent_true_default_value_with_dfs(): | ||
es = ft.EntitySet(id="customer_data") | ||
|
||
customers_df = pd.DataFrame(data={"customer_id": [1, 2]}) | ||
transactions_df = pd.DataFrame( | ||
data={"tx_id": [1], "customer_id": [1], "is_foo": [True]}, | ||
) | ||
|
||
es.add_dataframe( | ||
dataframe_name="customers_df", | ||
dataframe=customers_df, | ||
index="customer_id", | ||
) | ||
es.add_dataframe( | ||
dataframe_name="transactions_df", | ||
dataframe=transactions_df, | ||
index="tx_id", | ||
logical_types={"is_foo": BooleanNullable}, | ||
) | ||
|
||
es = es.add_relationship( | ||
"customers_df", | ||
"customer_id", | ||
"transactions_df", | ||
"customer_id", | ||
) | ||
|
||
feature_matrix, _ = ft.dfs( | ||
entityset=es, | ||
target_dataframe_name="customers_df", | ||
agg_primitives=["percent_true"], | ||
) | ||
|
||
assert pd.isna(feature_matrix["PERCENT_TRUE(transactions_df.is_foo)"][2]) |