@@ -356,7 +356,9 @@ def test_get_scalar(self):
356
356
for item in self .mgr .items :
357
357
for i , index in enumerate (self .mgr .axes [1 ]):
358
358
res = self .mgr .get_scalar ((item , index ))
359
- exp = self .mgr .get (item )[i ]
359
+ exp = self .mgr .get (item , fastpath = False )[i ]
360
+ assert_almost_equal (res , exp )
361
+ exp = self .mgr .get (item ).values [i ]
360
362
assert_almost_equal (res , exp )
361
363
362
364
def test_get (self ):
@@ -366,19 +368,22 @@ def test_get(self):
366
368
placement = np .arange (3 ))
367
369
mgr = BlockManager (blocks = [block ], axes = [cols , np .arange (3 )])
368
370
369
- assert_almost_equal (mgr .get ('a' ), values [0 ])
370
- assert_almost_equal (mgr .get ('b' ), values [1 ])
371
- assert_almost_equal (mgr .get ('c' ), values [2 ])
371
+ assert_almost_equal (mgr .get ('a' , fastpath = False ), values [0 ])
372
+ assert_almost_equal (mgr .get ('b' , fastpath = False ), values [1 ])
373
+ assert_almost_equal (mgr .get ('c' , fastpath = False ), values [2 ])
374
+ assert_almost_equal (mgr .get ('a' ).values , values [0 ])
375
+ assert_almost_equal (mgr .get ('b' ).values , values [1 ])
376
+ assert_almost_equal (mgr .get ('c' ).values , values [2 ])
372
377
373
378
def test_set (self ):
374
379
mgr = create_mgr ('a,b,c: int' , item_shape = (3 ,))
375
380
376
381
mgr .set ('d' , np .array (['foo' ] * 3 ))
377
382
mgr .set ('b' , np .array (['bar' ] * 3 ))
378
- assert_almost_equal (mgr .get ('a' ), [0 ] * 3 )
379
- assert_almost_equal (mgr .get ('b' ), ['bar' ] * 3 )
380
- assert_almost_equal (mgr .get ('c' ), [2 ] * 3 )
381
- assert_almost_equal (mgr .get ('d' ), ['foo' ] * 3 )
383
+ assert_almost_equal (mgr .get ('a' ). values , [0 ] * 3 )
384
+ assert_almost_equal (mgr .get ('b' ). values , ['bar' ] * 3 )
385
+ assert_almost_equal (mgr .get ('c' ). values , [2 ] * 3 )
386
+ assert_almost_equal (mgr .get ('d' ). values , ['foo' ] * 3 )
382
387
383
388
def test_insert (self ):
384
389
self .mgr .insert (0 , 'inserted' , np .arange (N ))
@@ -580,10 +585,14 @@ def test_reindex_items(self):
580
585
reindexed = mgr .reindex_axis (['g' , 'c' , 'a' , 'd' ], axis = 0 )
581
586
self .assertEqual (reindexed .nblocks , 2 )
582
587
assert_almost_equal (reindexed .items , ['g' , 'c' , 'a' , 'd' ])
583
- assert_almost_equal (mgr .get ('g' ), reindexed .get ('g' ))
584
- assert_almost_equal (mgr .get ('c' ), reindexed .get ('c' ))
585
- assert_almost_equal (mgr .get ('a' ), reindexed .get ('a' ))
586
- assert_almost_equal (mgr .get ('d' ), reindexed .get ('d' ))
588
+ assert_almost_equal (mgr .get ('g' ,fastpath = False ), reindexed .get ('g' ,fastpath = False ))
589
+ assert_almost_equal (mgr .get ('c' ,fastpath = False ), reindexed .get ('c' ,fastpath = False ))
590
+ assert_almost_equal (mgr .get ('a' ,fastpath = False ), reindexed .get ('a' ,fastpath = False ))
591
+ assert_almost_equal (mgr .get ('d' ,fastpath = False ), reindexed .get ('d' ,fastpath = False ))
592
+ assert_almost_equal (mgr .get ('g' ).values , reindexed .get ('g' ).values )
593
+ assert_almost_equal (mgr .get ('c' ).values , reindexed .get ('c' ).values )
594
+ assert_almost_equal (mgr .get ('a' ).values , reindexed .get ('a' ).values )
595
+ assert_almost_equal (mgr .get ('d' ).values , reindexed .get ('d' ).values )
587
596
588
597
def test_multiindex_xs (self ):
589
598
mgr = create_mgr ('a,b,c: f8; d,e,f: i8' )
@@ -608,16 +617,19 @@ def test_get_numeric_data(self):
608
617
609
618
numeric = mgr .get_numeric_data ()
610
619
assert_almost_equal (numeric .items , ['int' , 'float' , 'complex' , 'bool' ])
611
- assert_almost_equal (mgr .get ('float' ), numeric .get ('float' ))
620
+ assert_almost_equal (mgr .get ('float' ,fastpath = False ), numeric .get ('float' ,fastpath = False ))
621
+ assert_almost_equal (mgr .get ('float' ).values , numeric .get ('float' ).values )
612
622
613
623
# Check sharing
614
624
numeric .set ('float' , np .array ([100. , 200. , 300. ]))
615
- assert_almost_equal (mgr .get ('float' ), np .array ([100. , 200. , 300. ]))
625
+ assert_almost_equal (mgr .get ('float' ,fastpath = False ), np .array ([100. , 200. , 300. ]))
626
+ assert_almost_equal (mgr .get ('float' ).values , np .array ([100. , 200. , 300. ]))
616
627
617
628
numeric2 = mgr .get_numeric_data (copy = True )
618
629
assert_almost_equal (numeric .items , ['int' , 'float' , 'complex' , 'bool' ])
619
630
numeric2 .set ('float' , np .array ([1000. , 2000. , 3000. ]))
620
- assert_almost_equal (mgr .get ('float' ), np .array ([100. , 200. , 300. ]))
631
+ assert_almost_equal (mgr .get ('float' ,fastpath = False ), np .array ([100. , 200. , 300. ]))
632
+ assert_almost_equal (mgr .get ('float' ).values , np .array ([100. , 200. , 300. ]))
621
633
622
634
def test_get_bool_data (self ):
623
635
mgr = create_mgr ('int: int; float: float; complex: complex;'
@@ -627,15 +639,18 @@ def test_get_bool_data(self):
627
639
628
640
bools = mgr .get_bool_data ()
629
641
assert_almost_equal (bools .items , ['bool' ])
630
- assert_almost_equal (mgr .get ('bool' ), bools .get ('bool' ))
642
+ assert_almost_equal (mgr .get ('bool' ,fastpath = False ), bools .get ('bool' ,fastpath = False ))
643
+ assert_almost_equal (mgr .get ('bool' ).values , bools .get ('bool' ).values )
631
644
632
645
bools .set ('bool' , np .array ([True , False , True ]))
633
- assert_almost_equal (mgr .get ('bool' ), [True , False , True ])
646
+ assert_almost_equal (mgr .get ('bool' ,fastpath = False ), [True , False , True ])
647
+ assert_almost_equal (mgr .get ('bool' ).values , [True , False , True ])
634
648
635
649
# Check sharing
636
650
bools2 = mgr .get_bool_data (copy = True )
637
651
bools2 .set ('bool' , np .array ([False , True , False ]))
638
- assert_almost_equal (mgr .get ('bool' ), [True , False , True ])
652
+ assert_almost_equal (mgr .get ('bool' ,fastpath = False ), [True , False , True ])
653
+ assert_almost_equal (mgr .get ('bool' ).values , [True , False , True ])
639
654
640
655
def test_unicode_repr_doesnt_raise (self ):
641
656
str_repr = repr (create_mgr (u ('b,\u05d0 : object' )))
0 commit comments