These are chat archives for thunder-project/thunder
@dgoodwin208 By 'rows' I'm assuming you mean 'records'? Each record is indexed by it's key, so I can think of two options:
(1): if you don't need to put the
Series object back together again after breaking it into the two pieces, you could do two calls to
subseries1 = series.filterOnKeys(lambda k: criterion(k)) subseries2 = series.filterOnKeys(lambda k: not criterion(k))
Then you could do separate operations on each subset
(2): if you want to keep the
Series object together, then you could do a single call to
Series.apply using using a function that applies different operations depending on the keys:
def f(k, v): if criterion(k): vNew = ... else: vNew = ... return (k, vNew) series.apply(f)
In both cases
criterion is a function that take a key and returns a
bool indicating to which subset the record associate with the given key belongs.
applyoption might be a little quicker, since the
filteroption would involve filtering twice to get what is effectively the complement of records that the first
filteralready found, which would be a bit redundant. I'm interested to hear what you find!
applyroute might be the most straightforward, though there shouldn't be any duplication with the filtering version unless I'm missing something. might be helpful to know what comes next, you want to treat groups of rows as submatrices so that you can apply different operations to the two groups? what is that operation?