File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 40
40
41
41
import numpy as np
42
42
import pandas as pd
43
- from scipy .sparse import csc_array
43
+ from scipy .sparse import csc_matrix
44
44
from tqdm import tqdm
45
45
46
46
from pyretailscience .data .contracts import CustomContract , build_expected_columns , build_non_null_columns
@@ -234,7 +234,7 @@ def _calc_association( # noqa: C901 (ignore complexity) - Excluded due to min_*
234
234
unique_combo_df [value_col ] = pd .Categorical (unique_combo_df [value_col ], ordered = True )
235
235
unique_combo_df [group_col ] = pd .Categorical (unique_combo_df [group_col ], ordered = True )
236
236
237
- sparse_matrix = csc_array (
237
+ sparse_matrix = csc_matrix (
238
238
(
239
239
[1 ] * len (unique_combo_df ),
240
240
(
@@ -273,7 +273,7 @@ def _calc_association( # noqa: C901 (ignore complexity) - Excluded due to min_*
273
273
target_item_col_index [target_item_loc ] = True
274
274
rows_with_target_item = sparse_matrix [:, target_item_col_index ].getnnz (axis = 1 ) == len (target_item_loc )
275
275
276
- cooccurrences = sparse_matrix [rows_with_target_item , :].sum (axis = 0 ).flatten ()
276
+ cooccurrences = np . array ( sparse_matrix [rows_with_target_item , :].sum (axis = 0 ) ).flatten ()
277
277
if (cooccurrences == 0 ).all ():
278
278
continue
279
279
You can’t perform that action at this time.
0 commit comments