@@ -327,7 +327,7 @@ def range_to_slice(seq):
327
327
328
328
def larray_equal (first , other ):
329
329
return (first .axes == other .axes and
330
- np .array_equal (np .asarray (first ), np .asarray (other )))
330
+ np .array_equal (first .asarray (), other .asarray ()))
331
331
332
332
333
333
class Axis (object ):
@@ -498,7 +498,7 @@ def __repr__(self):
498
498
499
499
def unaryop (opname ):
500
500
def func (self ):
501
- method = getattr (np .asarray (self ), '__%s__' % opname )
501
+ method = getattr (self .asarray (), '__%s__' % opname )
502
502
return LArray (method (), self .axes )
503
503
return func
504
504
@@ -717,7 +717,7 @@ def as_table(self):
717
717
# result[1].append('total')
718
718
else :
719
719
result = []
720
- data = np .asarray (self ).ravel ()
720
+ data = self .asarray ().ravel ()
721
721
if axes_labels is not None :
722
722
categ_values = list (product (* axes_labels [:- 1 ]))
723
723
else :
@@ -756,7 +756,7 @@ def _axis_aggregate(self, op, axes):
756
756
op is an aggregate function: func(arr, axis=(0, 1))
757
757
axes is a tuple of axes (Axis objects or integers)
758
758
"""
759
- src_data = np .asarray (self )
759
+ src_data = self .asarray ()
760
760
if not axes :
761
761
# scalars do not need to be wrapped in LArray
762
762
return op (src_data )
@@ -850,6 +850,7 @@ def _group_aggregate(self, op, kwargs, commutative=False):
850
850
del arr
851
851
if killaxis :
852
852
assert group_idx [agg_axis_idx ] == 0
853
+ #FIXME: if this is the only axis, it will break
853
854
res_data = res_data [group_idx ]
854
855
res = LArray (res_data , res_axes )
855
856
@@ -917,9 +918,9 @@ def to_excel(self, filename, sep=None):
917
918
worksheet = workbook .add_worksheet ('Sheet1' )
918
919
worksheet .write_row (0 , 1 , self .axes [- 1 ].labels )
919
920
if self .ndim == 2 :
920
- worksheet .write_column (1 , 0 , self .axes [- 2 ].labels )
921
- for row , data in enumerate (np .asarray (self )):
922
- worksheet .write_row (1 + row , 1 , data )
921
+ worksheet .write_column (1 , 0 , self .axes [- 2 ].labels )
922
+ for row , data in enumerate (self .asarray ()):
923
+ worksheet .write_row (1 + row , 1 , data )
923
924
924
925
def transpose (self , * args ):
925
926
axes_names = set (axis .name for axis in args )
0 commit comments