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

Method modify_coordinates

tables/table.py:2428–2463  ·  view source on GitHub ↗

Modify a series of rows in positions specified in coords. The values in the selected rows will be modified with the data given in rows. This method returns the number of rows modified. The possible values for the rows argument are the same as in :meth:`Table.append

(
        self, coords: list | tuple | np.ndarray, rows: Sequence
    )

Source from the content-addressed store, hash-verified

2426 return recarr
2427
2428 def modify_coordinates(
2429 self, coords: list | tuple | np.ndarray, rows: Sequence
2430 ) -> int:
2431 """Modify a series of rows in positions specified in coords.
2432
2433 The values in the selected rows will be modified with the data given in
2434 rows. This method returns the number of rows modified.
2435
2436 The possible values for the rows argument are the same as in
2437 :meth:`Table.append`.
2438
2439 """
2440 if rows is None: # Nothing to be done
2441 return SizeType(0)
2442
2443 # Convert the coordinates to something expected by HDF5
2444 coords = self._point_selection(coords)
2445
2446 lcoords = len(coords)
2447 if len(rows) < lcoords:
2448 raise ValueError(
2449 "The value has not enough elements to fill-in "
2450 "the specified range"
2451 )
2452
2453 # Convert rows into a recarray
2454 recarr = self._conv_to_recarr(rows)
2455
2456 if len(coords) > 0:
2457 # Do the actual update of rows
2458 self._update_elements(lcoords, coords, recarr)
2459
2460 # Redo the index if needed
2461 self._reindex(self.colpathnames)
2462
2463 return SizeType(lcoords)
2464
2465 def modify_rows(
2466 self,

Callers 2

__setitem__Method · 0.95
test10aMethod · 0.80

Calls 3

_conv_to_recarrMethod · 0.95
_reindexMethod · 0.95
_point_selectionMethod · 0.80

Tested by 1

test10aMethod · 0.64