Skip to content

Commit f5409be

Browse files
committed
fixed a linting error and docstrings validation
1 parent c7e8737 commit f5409be

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
@@ -2105,17 +2105,20 @@ def to_feather(self, path, **kwargs) -> None:
21052105
@doc(
21062106
Series.to_markdown,
21072107
klass=_shared_doc_kwargs["klass"],
2108-
examples="""Examples
2109-
--------
2110-
>>> df = pd.DataFrame(
2111-
... data={"animal_1": ["elk", "pig"], "animal_2": ["dog", "quetzal"]}
2112-
... )
2113-
>>> print(df.to_markdown())
2114-
| | animal_1 | animal_2 |
2115-
|---:|:-----------|:-----------|
2116-
| 0 | elk | dog |
2117-
| 1 | pig | quetzal |
2118-
""",
2108+
examples=dedent(
2109+
"""
2110+
Examples
2111+
--------
2112+
>>> df = pd.DataFrame(
2113+
... data={"animal_1": ["elk", "pig"], "animal_2": ["dog", "quetzal"]}
2114+
... )
2115+
>>> print(df.to_markdown())
2116+
| | animal_1 | animal_2 |
2117+
|---:|:-----------|:-----------|
2118+
| 0 | elk | dog |
2119+
| 1 | pig | quetzal |
2120+
"""
2121+
),
21192122
)
21202123
def to_markdown(
21212124
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
@@ -1430,17 +1430,20 @@ def to_string(
14301430

14311431
@doc(
14321432
klass=_shared_doc_kwargs["klass"],
1433-
examples="""Examples
1434-
--------
1435-
>>> s = pd.Series(["elk", "pig", "dog", "quetzal"], name="animal")
1436-
>>> print(s.to_markdown())
1437-
| | animal |
1438-
|---:|:---------|
1439-
| 0 | elk |
1440-
| 1 | pig |
1441-
| 2 | dog |
1442-
| 3 | quetzal |
1443-
""",
1433+
examples=dedent(
1434+
"""
1435+
Examples
1436+
--------
1437+
>>> s = pd.Series(["elk", "pig", "dog", "quetzal"], name="animal")
1438+
>>> print(s.to_markdown())
1439+
| | animal |
1440+
|---:|:---------|
1441+
| 0 | elk |
1442+
| 1 | pig |
1443+
| 2 | dog |
1444+
| 3 | quetzal |
1445+
"""
1446+
),
14441447
)
14451448
def to_markdown(
14461449
self, buf: Optional[IO[str]] = None, mode: Optional[str] = None, **kwargs
@@ -1463,8 +1466,7 @@ def to_markdown(
14631466
-------
14641467
str
14651468
{klass} in Markdown-friendly format.
1466-
{examples}
1467-
"""
1469+
{examples}"""
14681470
return self.to_frame().to_markdown(buf, mode, **kwargs)
14691471

14701472
# ----------------------------------------------------------------------

0 commit comments

Comments
 (0)