Add a sequence of data to the end of the dataset. This method appends the objects in the sequence to a *single row* in this array. The type and shape of individual objects must be compliant with the atoms in the array. In the case of serialized objects and variable l
(self, sequence: npt.ArrayLike)
| 518 | return self.atom.enum |
| 519 | |
| 520 | def append(self, sequence: npt.ArrayLike) -> None: |
| 521 | """Add a sequence of data to the end of the dataset. |
| 522 | |
| 523 | This method appends the objects in the sequence to a *single row* in |
| 524 | this array. The type and shape of individual objects must be compliant |
| 525 | with the atoms in the array. In the case of serialized objects and |
| 526 | variable length strings, the object or string to append is itself the |
| 527 | sequence. |
| 528 | |
| 529 | """ |
| 530 | self._g_check_open() |
| 531 | self._v_file._check_writable() |
| 532 | |
| 533 | # Prepare the sequence to convert it into a NumPy object |
| 534 | atom = self.atom |
| 535 | if not hasattr(atom, "size"): # it is a pseudo-atom |
| 536 | sequence = atom.toarray(sequence) |
| 537 | statom = atom.base |
| 538 | else: |
| 539 | try: # fastest check in most cases |
| 540 | len(sequence) |
| 541 | except TypeError: |
| 542 | raise TypeError("argument is not a sequence") |
| 543 | statom = atom |
| 544 | |
| 545 | if len(sequence) > 0: |
| 546 | # The sequence needs to be copied to make the operation safe |
| 547 | # to in-place conversion. |
| 548 | nparr = convert_to_np_atom2(sequence, statom) |
| 549 | nobjects = self._getnobjects(nparr) |
| 550 | else: |
| 551 | nobjects = 0 |
| 552 | nparr = None |
| 553 | |
| 554 | self._append(nparr, nobjects) |
| 555 | self.nrows += 1 |
| 556 | |
| 557 | def iterrows( |
| 558 | self, |
no test coverage detected