@@ -2749,11 +2749,55 @@ def to_markdown(
2749
2749
** kwargs ,
2750
2750
) -> str | None : ...
2751
2751
2752
- @doc (
2753
- Series .to_markdown ,
2754
- klass = _shared_doc_kwargs ["klass" ],
2755
- storage_options = _shared_docs ["storage_options" ],
2756
- examples = """Examples
2752
+ def to_markdown (
2753
+ self ,
2754
+ buf : FilePath | WriteBuffer [str ] | None = None ,
2755
+ * ,
2756
+ mode : str = "wt" ,
2757
+ index : bool = True ,
2758
+ storage_options : StorageOptions | None = None ,
2759
+ ** kwargs ,
2760
+ ) -> str | None :
2761
+ """
2762
+ Print DataFrame in Markdown-friendly format.
2763
+
2764
+ Parameters
2765
+ ----------
2766
+ buf : str, Path or StringIO-like, optional, default None
2767
+ Buffer to write to. If None, the output is returned as a string.
2768
+ mode : str, optional
2769
+ Mode in which file is opened, "wt" by default.
2770
+ index : bool, optional, default True
2771
+ Add index (row) labels.
2772
+
2773
+ storage_options : dict, optional
2774
+ Extra options that make sense for a particular storage connection, e.g.
2775
+ host, port, username, password, etc. For HTTP(S) URLs the key-value pairs
2776
+ are forwarded to ``urllib.request.Request`` as header options. For other
2777
+ URLs (e.g. starting with "s3://", and "gcs://") the key-value pairs are
2778
+ forwarded to ``fsspec.open``. Please see ``fsspec`` and ``urllib`` for more
2779
+ details, and for more examples on storage options refer `here
2780
+ <https://pandas.pydata.org/docs/user_guide/io.html?
2781
+ highlight=storage_options#reading-writing-remote-files>`_.
2782
+
2783
+ **kwargs
2784
+ These parameters will be passed to `tabulate <https://pypi.org/project/tabulate>`_.
2785
+
2786
+ Returns
2787
+ -------
2788
+ str
2789
+ DataFrame in Markdown-friendly format.
2790
+
2791
+ See Also
2792
+ --------
2793
+ DataFrame.to_html : Render DataFrame to HTML-formatted table.
2794
+ DataFrame.to_latex : Render DataFrame to LaTeX-formatted table.
2795
+
2796
+ Notes
2797
+ -----
2798
+ Requires the `tabulate <https://pypi.org/project/tabulate>`_ package.
2799
+
2800
+ Examples
2757
2801
--------
2758
2802
>>> df = pd.DataFrame(
2759
2803
... data={"animal_1": ["elk", "pig"], "animal_2": ["dog", "quetzal"]}
@@ -2773,17 +2817,8 @@ def to_markdown(
2773
2817
| 0 | elk | dog |
2774
2818
+----+------------+------------+
2775
2819
| 1 | pig | quetzal |
2776
- +----+------------+------------+""" ,
2777
- )
2778
- def to_markdown (
2779
- self ,
2780
- buf : FilePath | WriteBuffer [str ] | None = None ,
2781
- * ,
2782
- mode : str = "wt" ,
2783
- index : bool = True ,
2784
- storage_options : StorageOptions | None = None ,
2785
- ** kwargs ,
2786
- ) -> str | None :
2820
+ +----+------------+------------+
2821
+ """
2787
2822
if "showindex" in kwargs :
2788
2823
raise ValueError ("Pass 'index' instead of 'showindex" )
2789
2824
0 commit comments