Skip to content

Commit 86a73c2

Browse files
committed
DOC: Fix read_hdf docstring
Read HDF docstring was not in NumPy format. Corrects the formatting [skip ci]
1 parent 8ddc0fd commit 86a73c2

File tree

1 file changed

+46
-27
lines changed

1 file changed

+46
-27
lines changed

pandas/io/pytables.py

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -282,38 +282,57 @@ def to_hdf(path_or_buf, key, value, mode=None, complevel=None, complib=None,
282282

283283

284284
def read_hdf(path_or_buf, key=None, mode='r', **kwargs):
285-
""" read from the store, close it if we opened it
286-
287-
Retrieve pandas object stored in file, optionally based on where
288-
criteria
285+
"""
286+
Read from the store, close it if we opened it.
289287
290-
Parameters
291-
----------
292-
path_or_buf : path (string), buffer or path object (pathlib.Path or
293-
py._path.local.LocalPath) designating the file to open, or an
294-
already opened pd.HDFStore object
288+
Retrieve pandas object stored in file, optionally based on where
289+
criteria
295290
296-
.. versionadded:: 0.19.0 support for pathlib, py.path.
291+
Parameters
292+
----------
293+
path_or_buf : string, buffer or path object
294+
Path to the file to open, or an open pd.HDFStore object.
295+
Supports pathlib.Path and py._path.local.LocalPath.
296+
297+
.. versionadded:: 0.19.0 support for pathlib, py.path.
298+
299+
key : object, optional
300+
The group identifier in the store. Can be omitted if the HDF file
301+
contains a single pandas object.
302+
mode : {'r', 'r+', 'a'}, optional
303+
Mode to use when opening the file. Ignored if path_or_buf is a
304+
pd.HDFStore. Default is 'r'.
305+
where : list, optional
306+
A list of Term (or convertible) objects.
307+
start : int, optional
308+
Row number to start selection.
309+
stop : int, optional
310+
Row number to stop selection.
311+
columns : list, optional
312+
A list of columns names to return.
313+
iterator : bool, optional
314+
Return an iterator object.
315+
chunksize : int, optional
316+
Number of rows to include in an iteration when using an iterator.
317+
kwargs : dict
318+
Additional keyword arguments passed to HDFStore.
297319
298-
key : group identifier in the store. Can be omitted if the HDF file
299-
contains a single pandas object.
300-
mode : string, {'r', 'r+', 'a'}, default 'r'. Mode to use when opening
301-
the file. Ignored if path_or_buf is a pd.HDFStore.
302-
where : list of Term (or convertible) objects, optional
303-
start : optional, integer (defaults to None), row number to start
304-
selection
305-
stop : optional, integer (defaults to None), row number to stop
306-
selection
307-
columns : optional, a list of columns that if not None, will limit the
308-
return columns
309-
iterator : optional, boolean, return an iterator, default False
310-
chunksize : optional, nrows to include in iteration, return an iterator
320+
Returns
321+
-------
322+
item : object
323+
The selected object. Return type depends on the object stored.
311324
312-
Returns
313-
-------
314-
The selected object
325+
See Also
326+
--------
327+
pandas.DataFrame.to_hdf : write a HDF file from a DataFrame
328+
pandas.HDFStore : low-level access to HDF files
315329
316-
"""
330+
Examples
331+
--------
332+
>>> df = pd.DataFrame([[1, 1.0, 'a']], columns=['x', 'y', 'z'])
333+
>>> df.to_hdf('./store.h5', 'data')
334+
>>> reread = pd.read_hdf('./store.h5')
335+
"""
317336

318337
if mode not in ['r', 'r+', 'a']:
319338
raise ValueError('mode {0} is not allowed while performing a read. '

0 commit comments

Comments
 (0)