Skip to content

Commit 70c9865

Browse files
committed
fixed doc strings
1 parent c85c0c2 commit 70c9865

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

pandas/core/frame.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,8 +2075,10 @@ def to_feather(self, path) -> None:
20752075

20762076
to_feather(self, path)
20772077

2078-
@Appender(
2079-
"""
2078+
@doc(
2079+
Series.to_markdown,
2080+
klass=_shared_doc_kwargs["klass"],
2081+
examples="""
20802082
Examples
20812083
--------
20822084
>>> df = pd.DataFrame(
@@ -2087,10 +2089,8 @@ def to_feather(self, path) -> None:
20872089
|---:|:-----------|:-----------|
20882090
| 0 | elk | dog |
20892091
| 1 | pig | quetzal |
2090-
"""
2092+
""",
20912093
)
2092-
@Substitution(klass="DataFrame")
2093-
@Appender(_shared_docs["to_markdown"])
20942094
def to_markdown(
20952095
self, buf: Optional[IO[str]] = None, mode: Optional[str] = None, **kwargs
20962096
) -> Optional[str]:

pandas/core/series.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,21 @@ def to_string(
14271427
with open(buf, "w") as f:
14281428
f.write(result)
14291429

1430-
@doc(klass=_shared_doc_kwargs["klass"])
1430+
@doc(
1431+
klass=_shared_doc_kwargs["klass"],
1432+
examples="""
1433+
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+
""",
1444+
)
14311445
def to_markdown(
14321446
self, buf: Optional[IO[str]] = None, mode: Optional[str] = None, **kwargs
14331447
) -> Optional[str]:
@@ -1450,16 +1464,7 @@ def to_markdown(
14501464
str
14511465
{klass} in Markdown-friendly format.
14521466
1453-
Examples
1454-
--------
1455-
>>> s = pd.Series(["elk", "pig", "dog", "quetzal"], name="animal")
1456-
>>> print(s.to_markdown())
1457-
| | animal |
1458-
|---:|:---------|
1459-
| 0 | elk |
1460-
| 1 | pig |
1461-
| 2 | dog |
1462-
| 3 | quetzal |
1467+
{examples}
14631468
"""
14641469
return self.to_frame().to_markdown(buf, mode, **kwargs)
14651470

0 commit comments

Comments
 (0)