Skip to content

DOC: Fixing EX01 - Added examples #53883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
pandas.read_clipboard \
pandas.ExcelFile \
pandas.ExcelFile.parse \
pandas.DataFrame.to_html \
pandas.io.formats.style.Styler.to_html \
pandas.HDFStore.put \
pandas.HDFStore.append \
pandas.HDFStore.get \
pandas.HDFStore.select \
pandas.HDFStore.info \
pandas.HDFStore.keys \
pandas.HDFStore.groups \
pandas.HDFStore.walk \
pandas.read_feather \
Expand Down
5 changes: 5 additions & 0 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3127,6 +3127,11 @@ def to_html(
See Also
--------
to_string : Convert DataFrame to a string.

Examples
--------
>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
>>> df.to_html() # doctest: +SKIP
"""
if justify is not None and justify not in fmt._VALID_JUSTIFY_PARAMETERS:
raise ValueError("Invalid value for justify parameter")
Expand Down
67 changes: 67 additions & 0 deletions pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,16 @@ def keys(self, include: str = "pandas") -> list[str]:
Raises
------
raises ValueError if kind has an illegal value

Examples
--------
>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
>>> store = pd.HDFStore("store.h5", 'w') # doctest: +SKIP
>>> store.put('data', df) # doctest: +SKIP
>>> store.get('data') # doctest: +SKIP
>>> print(store.keys()) # doctest: +SKIP
['/data1', '/data2']
>>> store.close() # doctest: +SKIP
"""
if include == "pandas":
return [n._v_pathname for n in self.groups()]
Expand Down Expand Up @@ -781,6 +791,14 @@ def get(self, key: str):
-------
object
Same type as object stored in file.

Examples
--------
>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
>>> store = pd.HDFStore("store.h5", 'w') # doctest: +SKIP
>>> store.put('data', df) # doctest: +SKIP
>>> store.get('data') # doctest: +SKIP
>>> store.close() # doctest: +SKIP
"""
with patch_pickle():
# GH#31167 Without this patch, pickle doesn't know how to unpickle
Expand Down Expand Up @@ -835,6 +853,24 @@ def select(
-------
object
Retrieved object from file.

Examples
--------
>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
>>> store = pd.HDFStore("store.h5", 'w') # doctest: +SKIP
>>> store.put('data', df) # doctest: +SKIP
>>> store.get('data') # doctest: +SKIP
>>> print(store.keys()) # doctest: +SKIP
['/data1', '/data2']
>>> store.select('/data1') # doctest: +SKIP
A B
0 1 2
1 3 4
>>> store.select('/data1', where='columns == A') # doctest: +SKIP
A
0 1
1 3
>>> store.close() # doctest: +SKIP
"""
group = self.get_node(key)
if group is None:
Expand Down Expand Up @@ -1107,6 +1143,12 @@ def put(
independent on creation time.
dropna : bool, default False, optional
Remove missing values.

Examples
--------
>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
>>> store = pd.HDFStore("store.h5", 'w') # doctest: +SKIP
>>> store.put('data', df) # doctest: +SKIP
"""
if format is None:
format = get_option("io.hdf.default_format") or "fixed"
Expand Down Expand Up @@ -1243,6 +1285,20 @@ def append(
-----
Does *not* check if data being appended overlaps with existing
data in the table, so be careful

Examples
--------
>>> df1 = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
>>> store = pd.HDFStore("store.h5", 'w') # doctest: +SKIP
>>> store.put('data', df1, format='table') # doctest: +SKIP
>>> df2 = pd.DataFrame([[5, 6], [7, 8]], columns=['A', 'B'])
>>> store.append('data', df2) # doctest: +SKIP
>>> store.close() # doctest: +SKIP
A B
0 1 2
1 3 4
0 5 6
1 7 8
"""
if columns is not None:
raise TypeError(
Expand Down Expand Up @@ -1578,6 +1634,17 @@ def info(self) -> str:
Returns
-------
str

Examples
--------
>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
>>> store = pd.HDFStore("store.h5", 'w') # doctest: +SKIP
>>> store.put('data', df) # doctest: +SKIP
>>> print(store.info()) # doctest: +SKIP
>>> store.close() # doctest: +SKIP
<class 'pandas.io.pytables.HDFStore'>
File path: store.h5
/data frame (shape->[2,2])
"""
path = pprint_thing(self._path)
output = f"{type(self)}\nFile path: {path}\n"
Expand Down