Skip to content

Commit

Permalink
Merge pull request #159 from omenSi/groupby
Browse files Browse the repository at this point in the history
Forgot to add TQDM to the groupby :)
  • Loading branch information
omenSi authored Apr 5, 2024
2 parents d5cd0de + f069b68 commit b20b78a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions nimlite/funcs/groupby.nim
Original file line number Diff line number Diff line change
Expand Up @@ -642,11 +642,7 @@ proc groupby*(T: nimpy.PyObject, keys: seq[string], functions: seq[(string, Accu
var columnsPaths: OrderedTable[string, seq[string]] = collect(initOrderedTable()):
for cn in columnNames:
{cn: tabliteBase.collectPages(T[cn])}

for cn in columnNames:
var pages: seq[string] = tabliteBase.collectPages(T[cn])
columnsPaths[cn] = pages

var pbar = tqdm!(desc: &"groupby", total: len(columnsPaths[toSeq(columnsPaths.keys)[0]]))
var aggregationFuncs = initOrderedTable[seq[PY_ObjectND], seq[(string, GroupByFunction)]]()
for pagesZipped in pageZipper(columnsPaths):
for row in iteratePages(pagesZipped):
Expand All @@ -666,6 +662,7 @@ proc groupby*(T: nimpy.PyObject, keys: seq[string], functions: seq[(string, Accu
aggFuncs = aggregationFuncs[key]
for (cn, fun) in aggFuncs:
fun.update(some(d[cn]))
discard pbar.update(1)

var keysFuncCols = keys
for (cn, acc) in functions:
Expand All @@ -692,7 +689,7 @@ proc groupby*(T: nimpy.PyObject, keys: seq[string], functions: seq[(string, Accu
for p in pages:
discard column.pages.append(p)
newTable[cn] = column

discard pbar.close()
return newTable

# when appType != "lib":
Expand Down

0 comments on commit b20b78a

Please sign in to comment.