-
Notifications
You must be signed in to change notification settings - Fork 884
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug in PercentTrue primitive (#2627)
* fix bug in PercentTrue primitive * Revert "fix bug in PercentTrue primitive" This reverts commit adbd640. * fix bug in PercentTrue primitive * update release notes * update miniconda hash
- Loading branch information
1 parent
f98704f
commit a622f62
Showing
4 changed files
with
44 additions
and
2 deletions.
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
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]) |