Skip to main content
`Ctrl`+`K`

# pandas.HDFStore.select_as_multiple

HDFStore.select_as_multiple(keys, where=None, selector=None, columns=None, start=None, stop=None, iterator=False, chunksize=None, auto_close=False)

  Retrieve pandas objects from multiple tables.

  Warning

  Pandas uses PyTables for reading and writing HDF5 files, which allows serializing object-dtype data with pickle when using the “fixed” format. Loading pickled data received from untrusted sources can be unsafe.

  See: https://docs.python.org/3/library/pickle.html for more.

  Parameters:
    keys list of str

      Names of the tables to read.

    where list, optional

      List of Term (or convertible) objects.

    selector str, optional

      The table to apply the where criteria to. Defaults to `keys[0]`.

    columns list, optional

      Columns to return.

    start int, optional

      Row number to start selection. Applied to each table before `where` is evaluated.

    stop int, optional

      Row number to stop selection. Applied to each table before `where` is evaluated.

    iterator bool, default False

      Return an iterator.

    chunksize int, optional

      Number of rows to include in each iteration; implies `iterator=True`.

    auto_close bool, default False

      Should automatically close the store when finished.

  Returns:
    DataFrame or TableIterator

      Concatenated result from the selected tables. A `TableIterator` is returned instead when `iterator=True` or `chunksize` is given.

  Raises:
    KeyError

      If `keys` or `selector` is not found, or `keys` is empty.

    TypeError

      If `keys` is not a list or tuple.

    ValueError

      If the tables do not all have the same number of rows.

  See also

  `HDFStore.append_to_multiple`

    Append to multiple tables, splitting a single object into a dict of column groups.

  `HDFStore.select`

    Retrieve a single stored object.

  Examples

      >>> df1 = pd.DataFrame([[1, 2], [3, 4]], columns=["A", "B"])
      >>> df2 = pd.DataFrame([[5, 6], [7, 8]], columns=["C", "D"])
      >>> store = pd.HDFStore("store.h5", "w")
      >>> store.append("t1", df1, format="table")
      >>> store.append("t2", df2, format="table")
      >>> store.select_as_multiple(["t1", "t2"])
      >>> store.close()