Skip to content

Commit c222204

Browse files
committed
fixed a linting error and docstrings validation
1 parent f639025 commit c222204

File tree

2 files changed

+29
-24
lines changed

2 files changed

+29
-24
lines changed

pandas/core/frame.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2120,17 +2120,20 @@ def to_feather(self, path, **kwargs) -> None:
21202120
@doc(
21212121
Series.to_markdown,
21222122
klass=_shared_doc_kwargs["klass"],
2123-
examples="""Examples
2124-
--------
2125-
>>> df = pd.DataFrame(
2126-
... data={"animal_1": ["elk", "pig"], "animal_2": ["dog", "quetzal"]}
2127-
... )
2128-
>>> print(df.to_markdown())
2129-
| | animal_1 | animal_2 |
2130-
|---:|:-----------|:-----------|
2131-
| 0 | elk | dog |
2132-
| 1 | pig | quetzal |
2133-
""",
2123+
examples=dedent(
2124+
"""
2125+
Examples
2126+
--------
2127+
>>> df = pd.DataFrame(
2128+
... data={"animal_1": ["elk", "pig"], "animal_2": ["dog", "quetzal"]}
2129+
... )
2130+
>>> print(df.to_markdown())
2131+
| | animal_1 | animal_2 |
2132+
|---:|:-----------|:-----------|
2133+
| 0 | elk | dog |
2134+
| 1 | pig | quetzal |
2135+
"""
2136+
),
21342137
)
21352138
def to_markdown(
21362139
self, buf: Optional[IO[str]] = None, mode: Optional[str] = None, **kwargs

pandas/core/series.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,17 +1409,20 @@ def to_string(
14091409

14101410
@doc(
14111411
klass=_shared_doc_kwargs["klass"],
1412-
examples="""Examples
1413-
--------
1414-
>>> s = pd.Series(["elk", "pig", "dog", "quetzal"], name="animal")
1415-
>>> print(s.to_markdown())
1416-
| | animal |
1417-
|---:|:---------|
1418-
| 0 | elk |
1419-
| 1 | pig |
1420-
| 2 | dog |
1421-
| 3 | quetzal |
1422-
""",
1412+
examples=dedent(
1413+
"""
1414+
Examples
1415+
--------
1416+
>>> s = pd.Series(["elk", "pig", "dog", "quetzal"], name="animal")
1417+
>>> print(s.to_markdown())
1418+
| | animal |
1419+
|---:|:---------|
1420+
| 0 | elk |
1421+
| 1 | pig |
1422+
| 2 | dog |
1423+
| 3 | quetzal |
1424+
"""
1425+
),
14231426
)
14241427
def to_markdown(
14251428
self, buf: Optional[IO[str]] = None, mode: Optional[str] = None, **kwargs
@@ -1442,8 +1445,7 @@ def to_markdown(
14421445
-------
14431446
str
14441447
{klass} in Markdown-friendly format.
1445-
{examples}
1446-
"""
1448+
{examples}"""
14471449
return self.to_frame().to_markdown(buf, mode, **kwargs)
14481450

14491451
# ----------------------------------------------------------------------

0 commit comments

Comments
 (0)