Create a pytables index on the table. Parameters ---------- key : str columns : None, bool, or listlike[str] Indicate which columns to create an index on. * False : Do not create any indexes. * True : Create indexes on al
(
self,
key: str,
columns=None,
optlevel: int | None = None,
kind: str | None = None,
)
| 1513 | self.append(k, val, data_columns=dc, min_itemsize=filtered, **kwargs) |
| 1514 | |
| 1515 | def create_table_index( |
| 1516 | self, |
| 1517 | key: str, |
| 1518 | columns=None, |
| 1519 | optlevel: int | None = None, |
| 1520 | kind: str | None = None, |
| 1521 | ) -> None: |
| 1522 | """ |
| 1523 | Create a pytables index on the table. |
| 1524 | |
| 1525 | Parameters |
| 1526 | ---------- |
| 1527 | key : str |
| 1528 | columns : None, bool, or listlike[str] |
| 1529 | Indicate which columns to create an index on. |
| 1530 | |
| 1531 | * False : Do not create any indexes. |
| 1532 | * True : Create indexes on all columns. |
| 1533 | * None : Create indexes on all columns. |
| 1534 | * listlike : Create indexes on the given columns. |
| 1535 | |
| 1536 | optlevel : int or None, default None |
| 1537 | Optimization level, if None, pytables defaults to 6. |
| 1538 | kind : str or None, default None |
| 1539 | Kind of index, if None, pytables defaults to "medium". |
| 1540 | |
| 1541 | Raises |
| 1542 | ------ |
| 1543 | TypeError: raises if the node is not a table |
| 1544 | """ |
| 1545 | # version requirements |
| 1546 | _tables() |
| 1547 | s = self.get_storer(key) |
| 1548 | if s is None: |
| 1549 | return |
| 1550 | |
| 1551 | if not isinstance(s, Table): |
| 1552 | raise TypeError("cannot create table index on a Fixed format store") |
| 1553 | s.create_index(columns=columns, optlevel=optlevel, kind=kind) |
| 1554 | |
| 1555 | def groups(self) -> list: |
| 1556 | """ |