Commits

Gregory Haskins  committed 80c8283

Numpy builtins used as aggregation function return 0-d tabarrays. Make sure
these aren't treated like lists/vectors (`len()` will fail).

  • Participants
  • Parent commits 276bf10

Comments (0)

Files changed (1)

File tabular/spreadsheet.py

     
     AggColDict = dict([(o,[f(X[g][Diffs[i]+1:Diffs[i+1]+1]) if argcounts[o] == 1 else f(X[g][Diffs[i]+1:Diffs[i+1]+1],X) for i in range(len(Diffs) - 1)]) for (o,f,g) in AggList])
     
-    if isinstance(AggColDict[AggList[0][0]][0],list) or isinstance(AggColDict[AggList[0][0]][0],np.ndarray):
+    FirstItem = np.asarray(AggColDict[AggList[0][0]][0])
+    if FirstItem.shape:
         lens = [len(l) for l in AggColDict[AggList[0][0]]]
         OnCols = OnCols.repeat(lens)
         for o in AggColDict.keys():