Skip to content

Commit fcb3357

Browse files
DOC: Fixing EX01 - Added examples (pandas-dev#54210)
* Examples pandas.test, read_feather... * add skip doctest * Correct code_checks.sh --------- Co-authored-by: Marco Edward Gorelli <[email protected]>
1 parent be63ff5 commit fcb3357

File tree

7 files changed

+28
-6
lines changed

7 files changed

+28
-6
lines changed

ci/code_checks.sh

-6
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7373
pandas.errors.PyperclipWindowsException \
7474
pandas.errors.UnsortedIndexError \
7575
pandas.errors.UnsupportedFunctionCall \
76-
pandas.test \
7776
pandas.NaT \
78-
pandas.read_feather \
79-
pandas.read_orc \
80-
pandas.read_sas \
81-
pandas.read_spss \
82-
pandas.read_sql_query \
8377
pandas.io.stata.StataReader.data_label \
8478
pandas.io.stata.StataReader.value_labels \
8579
pandas.io.stata.StataReader.variable_labels \

pandas/io/feather_format.py

+4
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ def read_feather(
103103
Returns
104104
-------
105105
type of object stored in file
106+
107+
Examples
108+
--------
109+
>>> df = pd.read_feather("path/to/file.feather") # doctest: +SKIP
106110
"""
107111
import_optional_dependency("pyarrow")
108112
from pyarrow import feather

pandas/io/orc.py

+4
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ def read_orc(
9595
a ``pyarrow.fs`` filesystem will be attempted to read the file. You can also pass a
9696
pyarrow or fsspec filesystem object into the filesystem keyword to override this
9797
behavior.
98+
99+
Examples
100+
--------
101+
>>> result = pd.read_orc("example_pa.orc") # doctest: +SKIP
98102
"""
99103
# we require a newer version of pyarrow than we support for parquet
100104

pandas/io/sas/sasreader.py

+4
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ def read_sas(
126126
-------
127127
DataFrame if iterator=False and chunksize=None, else SAS7BDATReader
128128
or XportReader
129+
130+
Examples
131+
--------
132+
>>> df = pd.read_sas("sas_data.sas7bdat") # doctest: +SKIP
129133
"""
130134
if format is None:
131135
buffer_error_msg = (

pandas/io/spss.py

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ def read_spss(
5050
Returns
5151
-------
5252
DataFrame
53+
54+
Examples
55+
--------
56+
>>> df = pd.read_spss("spss_data.sav") # doctest: +SKIP
5357
"""
5458
pyreadstat = import_optional_dependency("pyreadstat")
5559
check_dtype_backend(dtype_backend)

pandas/io/sql.py

+7
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,13 @@ def read_sql_query(
468468
-----
469469
Any datetime values with time zone information parsed via the `parse_dates`
470470
parameter will be converted to UTC.
471+
472+
Examples
473+
--------
474+
>>> from sqlalchemy import create_engine # doctest: +SKIP
475+
>>> engine = create_engine("sqlite:///database.db") # doctest: +SKIP
476+
>>> with engine.connect() as conn, conn.begin(): # doctest: +SKIP
477+
... data = pd.read_sql_table("data", conn) # doctest: +SKIP
471478
"""
472479

473480
check_dtype_backend(dtype_backend)

pandas/util/_tester.py

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ def test(extra_args: list[str] | None = None, run_doctests: bool = False) -> Non
2525
Whether to only run the Python and Cython doctests. If you would like to run
2626
both doctests/regular tests, just append "--doctest-modules"/"--doctest-cython"
2727
to extra_args.
28+
29+
Examples
30+
--------
31+
>>> pd.test() # doctest: +SKIP
32+
running: pytest...
2833
"""
2934
pytest = import_optional_dependency("pytest")
3035
import_optional_dependency("hypothesis")

0 commit comments

Comments
 (0)