Closed
Description
cc @mroeschke w/r/t rolling ._apply
, @WillAyd w/r/t _cython_agg_blocks
, and anyone else w/r/t DataFrame._reduce
with numeric_only=None
, apply.FrameApply
with ignore_failures=True
.
All of these do something along the lines of:
results = []
exclude = []
for i, block in enumerate(mgr.blocks):
try:
res = func(block.values)
results.append(res)
except:
exclude.append(i)
out = reconstruct(results, exclude)
Two things should be done with this pattern:
- Deprecate it, since it is a disproportionate maintainence burden
- implement something like
BlockManager.apply_with_ignore_failures
that would resemble BlockManager.apply but with the try/except logic*
* We could add that logic into BlockManager.apply, but BM.apply assumes the output has the same shape as the original frame, which I don't think holds for the cases mentioned above, so that would be a little more invasive than just adding a try/except.