@@ -361,13 +361,13 @@ def test_category_product_not_cat(random_gen):
361361
362362def test_category_interaction ():
363363 c = pd .Series (pd .Categorical ([0 , 0 , 0 , 1 , 1 , 1 ]))
364- actual = category_interaction (c , precondition = False ).A
364+ actual = category_interaction (c , precondition = False ).toarray ()
365365 expected = np .zeros ((6 , 2 ))
366366 expected [:3 , 0 ] = 1.0
367367 expected [3 :, 1 ] = 1.0
368368 assert_allclose (actual , expected )
369369
370- actual = category_interaction (c , precondition = True ).A
370+ actual = category_interaction (c , precondition = True ).toarray ()
371371 cond = np .sqrt ((expected ** 2 ).sum (0 ))
372372 expected /= cond
373373 assert_allclose (actual , expected )
@@ -381,12 +381,12 @@ def test_category_continuous_interaction():
381381 expected [:3 , 0 ] = v [:3 ]
382382 expected [3 :, 1 ] = v [3 :]
383383
384- assert_allclose (actual .A , expected )
384+ assert_allclose (actual .toarray () , expected )
385385
386386 actual = category_continuous_interaction (c , v , precondition = True )
387387 cond = np .sqrt ((expected ** 2 ).sum (0 ))
388388 expected /= cond
389- assert_allclose (actual .A , expected )
389+ assert_allclose (actual .toarray () , expected )
390390
391391
392392def test_category_continuous_interaction_interwoven ():
@@ -396,7 +396,7 @@ def test_category_continuous_interaction_interwoven():
396396 expected = np .zeros ((6 , 2 ))
397397 expected [::2 , 0 ] = v [::2 ]
398398 expected [1 ::2 , 1 ] = v [1 ::2 ]
399- assert_allclose (actual .A , expected )
399+ assert_allclose (actual .toarray () , expected )
400400
401401
402402def test_interaction_cat_only (cat ):
@@ -406,7 +406,7 @@ def test_interaction_cat_only(cat):
406406 expected = category_interaction (category_product (cat ), precondition = False )
407407 actual = interact .sparse
408408 assert isinstance (actual , csc_matrix )
409- assert_allclose (expected .A , actual .A )
409+ assert_allclose (expected .toarray () , actual .toarray () )
410410
411411
412412def test_interaction_cont_only (cont ):
@@ -416,15 +416,15 @@ def test_interaction_cont_only(cont):
416416 expected = cont .to_numpy ()
417417 actual = interact .sparse
418418 assert isinstance (actual , csc_matrix )
419- assert_allclose (expected , actual .A )
419+ assert_allclose (expected , actual .toarray () )
420420
421421
422422def test_interaction_cat_cont (cat , cont ):
423423 interact = Interaction (cat = cat , cont = cont )
424424 assert interact .nobs == cat .shape [0 ]
425425 assert_frame_equal (cat , interact .cat )
426426 assert_frame_equal (cont , interact .cont )
427- base = category_interaction (category_product (cat ), precondition = False ).A
427+ base = category_interaction (category_product (cat ), precondition = False ).toarray ()
428428 expected = []
429429 for i in range (cont .shape [1 ]):
430430 element = base .copy ()
@@ -433,13 +433,13 @@ def test_interaction_cat_cont(cat, cont):
433433 expected = np .column_stack (expected )
434434 actual = interact .sparse
435435 assert isinstance (actual , csc_matrix )
436- assert_allclose (expected , interact .sparse .A )
436+ assert_allclose (expected , interact .sparse .toarray () )
437437
438438
439439def test_interaction_from_frame (cat , cont ):
440440 base = Interaction (cat = cat , cont = cont )
441441 interact = Interaction .from_frame (pd .concat ([cat , cont ], axis = 1 ))
442- assert_allclose (base .sparse .A , interact .sparse .A )
442+ assert_allclose (base .sparse .toarray () , interact .sparse .toarray () )
443443
444444
445445def test_interaction_cat_bad_nobs ():
@@ -458,7 +458,7 @@ def test_empty_interaction():
458458def test_interaction_cat_cont_convert (cat , cont ):
459459 base = Interaction (cat , cont )
460460 interact = Interaction (cat .to_numpy (), cont )
461- assert_allclose (base .sparse .A , interact .sparse .A )
461+ assert_allclose (base .sparse .toarray () , interact .sparse .toarray () )
462462
463463
464464def test_absorbing_regressors (cat , cont , interact , weights ):
@@ -486,7 +486,7 @@ def test_absorbing_regressors(cat, cont, interact, weights):
486486 assert expected .shape == actual .shape
487487 assert_array_equal (expected .indptr , actual .indptr )
488488 assert_array_equal (expected .indices , actual .indices )
489- assert_allclose (expected .A , actual .A )
489+ assert_allclose (expected .toarray () , actual .toarray () )
490490 assert expected_rank == rank
491491
492492
@@ -532,11 +532,11 @@ def test_against_ols(ols_data):
532532 if ols_data .absorb .cat .shape [1 ] > 0 :
533533 dummies = dummy_matrix (ols_data .absorb .cat , precondition = False )[0 ]
534534 assert isinstance (dummies , sp .csc_matrix )
535- absorb .append (dummies .A )
535+ absorb .append (dummies .toarray () )
536536 has_dummy = ols_data .absorb .cat .shape [1 ] > 0
537537 if ols_data .interactions is not None :
538538 for interact in ols_data .interactions :
539- absorb .append (interact .sparse .A )
539+ absorb .append (interact .sparse .toarray () )
540540 _x = ols_data .x
541541 if absorb :
542542 absorb = np .column_stack (absorb )
0 commit comments