MCPcopy Create free account
hub / github.com/PyTables/PyTables / set_output

Method set_output

tables/expression.py:353–386  ·  view source on GitHub ↗

Set out as container for output as well as the append_mode. The out must be a container that is meant to keep the outcome of the expression. It should be an homogeneous type container and can typically be an Array, CArray, EArray, Column or a NumPy ndarray. The app

(
        self, out: ContainerType, append_mode: bool = False
    )

Source from the content-addressed store, hash-verified

351 self.step = step
352
353 def set_output(
354 self, out: ContainerType, append_mode: bool = False
355 ) -> None:
356 """Set out as container for output as well as the append_mode.
357
358 The out must be a container that is meant to keep the outcome of
359 the expression. It should be an homogeneous type container and
360 can typically be an Array, CArray, EArray, Column or a NumPy ndarray.
361
362 The append_mode specifies the way of which the output is filled.
363 If true, the rows of the outcome are *appended* to the out container.
364 Of course, for doing this it is necessary that out would have an
365 append() method (like an EArray, for example).
366
367 If append_mode is false, the output is set via the __setitem__()
368 method (see the Expr.set_output_range() for info on how to select
369 the rows to be updated). If out is smaller than what is required
370 by the expression, only the computations that are needed to fill
371 up the container are carried out. If it is larger, the excess
372 elements are unaffected.
373
374 """
375 if not (hasattr(out, "shape") and hasattr(out, "__setitem__")):
376 raise ValueError(
377 "You need to pass a settable multidimensional container "
378 "as output"
379 )
380 self.out = out
381 if append_mode and not hasattr(out, "append"):
382 raise ValueError(
383 "For activating the ``append`` mode, you need a container "
384 "with an `append()` method (like the `EArray`)"
385 )
386 self.append_mode = append_mode
387
388 def set_output_range(
389 self,

Callers 14

test01_outMethod · 0.95
test01a_outMethod · 0.95
test01b_out_scalarsMethod · 0.95
test01_outMethod · 0.95
test01_appendMethod · 0.95
test00_simpleMethod · 0.95
test01_maindimMethod · 0.95
test00_simpleMethod · 0.95
compute_tablesFunction · 0.95
process_fileFunction · 0.95

Calls

no outgoing calls

Tested by 10

test01_outMethod · 0.76
test01a_outMethod · 0.76
test01b_out_scalarsMethod · 0.76
test01_outMethod · 0.76
test01_appendMethod · 0.76
test00_simpleMethod · 0.76
test01_maindimMethod · 0.76
test00_simpleMethod · 0.76