Skip to content

Commit 9032a7b

Browse files
committed
fixed a linting error and docstrings validation
1 parent e1f60c9 commit 9032a7b

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
@@ -1412,17 +1412,20 @@ def to_string(
14121412

14131413
@doc(
14141414
klass=_shared_doc_kwargs["klass"],
1415-
examples="""Examples
1416-
--------
1417-
>>> s = pd.Series(["elk", "pig", "dog", "quetzal"], name="animal")
1418-
>>> print(s.to_markdown())
1419-
| | animal |
1420-
|---:|:---------|
1421-
| 0 | elk |
1422-
| 1 | pig |
1423-
| 2 | dog |
1424-
| 3 | quetzal |
1425-
""",
1415+
examples=dedent(
1416+
"""
1417+
Examples
1418+
--------
1419+
>>> s = pd.Series(["elk", "pig", "dog", "quetzal"], name="animal")
1420+
>>> print(s.to_markdown())
1421+
| | animal |
1422+
|---:|:---------|
1423+
| 0 | elk |
1424+
| 1 | pig |
1425+
| 2 | dog |
1426+
| 3 | quetzal |
1427+
"""
1428+
),
14261429
)
14271430
def to_markdown(
14281431
self, buf: Optional[IO[str]] = None, mode: Optional[str] = None, **kwargs
@@ -1445,8 +1448,7 @@ def to_markdown(
14451448
-------
14461449
str
14471450
{klass} in Markdown-friendly format.
1448-
{examples}
1449-
"""
1451+
{examples}"""
14501452
return self.to_frame().to_markdown(buf, mode, **kwargs)
14511453

14521454
# ----------------------------------------------------------------------

0 commit comments

Comments
 (0)