Skip to content

Commit e476667

Browse files
committed
fixed a linting error and docstrings validation
1 parent 9b3c6c7 commit e476667

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
@@ -2187,17 +2187,20 @@ def to_feather(self, path, **kwargs) -> None:
21872187
@doc(
21882188
Series.to_markdown,
21892189
klass=_shared_doc_kwargs["klass"],
2190-
examples="""Examples
2191-
--------
2192-
>>> df = pd.DataFrame(
2193-
... data={"animal_1": ["elk", "pig"], "animal_2": ["dog", "quetzal"]}
2194-
... )
2195-
>>> print(df.to_markdown())
2196-
| | animal_1 | animal_2 |
2197-
|---:|:-----------|:-----------|
2198-
| 0 | elk | dog |
2199-
| 1 | pig | quetzal |
2200-
""",
2190+
examples=dedent(
2191+
"""
2192+
Examples
2193+
--------
2194+
>>> df = pd.DataFrame(
2195+
... data={"animal_1": ["elk", "pig"], "animal_2": ["dog", "quetzal"]}
2196+
... )
2197+
>>> print(df.to_markdown())
2198+
| | animal_1 | animal_2 |
2199+
|---:|:-----------|:-----------|
2200+
| 0 | elk | dog |
2201+
| 1 | pig | quetzal |
2202+
"""
2203+
),
22012204
)
22022205
def to_markdown(
22032206
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
@@ -1404,17 +1404,20 @@ def to_string(
14041404

14051405
@doc(
14061406
klass=_shared_doc_kwargs["klass"],
1407-
examples="""Examples
1408-
--------
1409-
>>> s = pd.Series(["elk", "pig", "dog", "quetzal"], name="animal")
1410-
>>> print(s.to_markdown())
1411-
| | animal |
1412-
|---:|:---------|
1413-
| 0 | elk |
1414-
| 1 | pig |
1415-
| 2 | dog |
1416-
| 3 | quetzal |
1417-
""",
1407+
examples=dedent(
1408+
"""
1409+
Examples
1410+
--------
1411+
>>> s = pd.Series(["elk", "pig", "dog", "quetzal"], name="animal")
1412+
>>> print(s.to_markdown())
1413+
| | animal |
1414+
|---:|:---------|
1415+
| 0 | elk |
1416+
| 1 | pig |
1417+
| 2 | dog |
1418+
| 3 | quetzal |
1419+
"""
1420+
),
14181421
)
14191422
def to_markdown(
14201423
self, buf: Optional[IO[str]] = None, mode: Optional[str] = None, **kwargs
@@ -1437,8 +1440,7 @@ def to_markdown(
14371440
-------
14381441
str
14391442
{klass} in Markdown-friendly format.
1440-
{examples}
1441-
"""
1443+
{examples}"""
14421444
return self.to_frame().to_markdown(buf, mode, **kwargs)
14431445

14441446
# ----------------------------------------------------------------------

0 commit comments

Comments
 (0)