MCPcopy
hub / github.com/dask/dask / remove

Method remove

dask/bag/core.py:709–726  ·  view source on GitHub ↗

Remove elements in collection that match predicate. >>> def iseven(x): ... return x % 2 == 0 >>> import dask.bag as db >>> b = db.from_sequence(range(5)) >>> list(b.remove(iseven)) [1, 3]

(self, predicate)

Source from the content-addressed store, hash-verified

707 return type(self)(graph, name, self.npartitions)
708
709 def remove(self, predicate):
710 """Remove elements in collection that match predicate.
711
712 >>> def iseven(x):
713 ... return x % 2 == 0
714
715 >>> import dask.bag as db
716 >>> b = db.from_sequence(range(5))
717 >>> list(b.remove(iseven))
718 [1, 3]
719 """
720 name = f"remove-{funcname(predicate)}-{tokenize(self, predicate)}"
721 dsk = {
722 (name, i): (reify, (remove, predicate, (self.name, i)))
723 for i in range(self.npartitions)
724 }
725 graph = HighLevelGraph.from_collections(name, dsk, dependencies=[self])
726 return type(self)(graph, name, self.npartitions)
727
728 def map_partitions(self, func, *args, **kwargs):
729 """Apply a function to every partition across one or more bags.

Callers 15

ensure_fileFunction · 0.80
_toposortFunction · 0.80
orderFunction · 0.80
add_to_resultFunction · 0.80
start_state_from_daskFunction · 0.80
finish_taskFunction · 0.80
tmpfileFunction · 0.80
tmpdirFunction · 0.80
filetextsFunction · 0.80
fuse_linearFunction · 0.80
fuseFunction · 0.80
unregisterMethod · 0.80

Calls 3

funcnameFunction · 0.90
from_collectionsMethod · 0.80
tokenizeFunction · 0.50

Tested by 12

test_removeFunction · 0.64
test_bag_pathsFunction · 0.64
test_extra_fileFunction · 0.64
test_to_csv_pathsFunction · 0.64
test_to_csv_headerFunction · 0.64
test_hdf_filenamesFunction · 0.64
test_ensure_fileFunction · 0.64
test_prohibit_reuseFunction · 0.64
test_finish_taskFunction · 0.64