Skip to main content
`Ctrl`+`K`

# pandas.HDFStore.select

HDFStore.select(key, where=None, start=None, stop=None, columns=None, iterator=False, chunksize=None, auto_close=False)

  Retrieve pandas object stored in file, optionally based on where criteria.

  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:
    key str

      Object being retrieved from file.

    where list or None

      List of Term (or convertible) objects, optional.

    start int or None

      Row number to start selection.

    stop int, default None

      Row number to stop selection.

    columns list or None

      A list of columns that if not None, will limit the return columns.

    iterator bool or False

      Returns an iterator.

    chunksize int or None

      Number or rows to include in iteration, return an iterator.

    auto_close bool or False

      Should automatically close the store when finished.

  Returns:
    object

      Retrieved object from file.

  See also

  `HDFStore.select_as_coordinates`

    Returns the selection as an index.

  `HDFStore.select_column`

    Returns a single column from the table.

  `HDFStore.select_as_multiple`

    Retrieves pandas objects from multiple tables.

  Examples

      >>> df = pd.DataFrame([[1, 2], [3, 4]], columns=["A", "B"])
      >>> store = pd.HDFStore("store.h5", "w")
      >>> store.put("data", df)
      >>> store.get("data")
      >>> print(store.keys())
      ['/data1', '/data2']
      >>> store.select("/data1")
         A  B
      0  1  2
      1  3  4
      >>> store.select("/data1", where="columns == A")
         A
      0  1
      1  3
      >>> store.close()