Skip to content

Commit 354fd01

Browse files
authored
BUG: DataFrame.to_markdown with an empty frame (#38406)
1 parent dc674dd commit 354fd01

File tree

5 files changed

+84
-4
lines changed

5 files changed

+84
-4
lines changed

ci/deps/azure-38.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ dependencies:
1717
- python-dateutil
1818
- nomkl
1919
- pytz
20-
- tabulate==0.8.3
20+
- tabulate==0.8.7

doc/source/getting_started/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ pyreadstat SPSS files (.sav) reading
283283
pyxlsb 1.0.6 Reading for xlsb files
284284
qtpy Clipboard I/O
285285
s3fs 0.4.0 Amazon S3 access
286-
tabulate 0.8.3 Printing in Markdown-friendly format (see `tabulate`_)
286+
tabulate 0.8.7 Printing in Markdown-friendly format (see `tabulate`_)
287287
xarray 0.12.3 pandas-like API for N-dimensional data
288288
xclip Clipboard I/O on linux
289289
xlrd 1.2.0 Excel reading

doc/source/whatsnew/v1.3.0.rst

+70-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,76 @@ These are bug fixes that might have notable behavior changes.
3737

3838
Increased minimum versions for dependencies
3939
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40-
40+
Some minimum supported versions of dependencies were updated.
41+
If installed, we now require:
42+
43+
+-----------------+-----------------+----------+---------+
44+
| Package | Minimum Version | Required | Changed |
45+
+=================+=================+==========+=========+
46+
| numpy | 1.16.5 | X | |
47+
+-----------------+-----------------+----------+---------+
48+
| pytz | 2017.3 | X | |
49+
+-----------------+-----------------+----------+---------+
50+
| python-dateutil | 2.7.3 | X | |
51+
+-----------------+-----------------+----------+---------+
52+
| bottleneck | 1.2.1 | | |
53+
+-----------------+-----------------+----------+---------+
54+
| numexpr | 2.6.8 | | |
55+
+-----------------+-----------------+----------+---------+
56+
| pytest (dev) | 5.0.1 | | |
57+
+-----------------+-----------------+----------+---------+
58+
| mypy (dev) | 0.782 | | |
59+
+-----------------+-----------------+----------+---------+
60+
61+
For `optional libraries <https://dev.pandas.io/docs/install.html#dependencies>`_ the general recommendation is to use the latest version.
62+
The following table lists the lowest version per library that is currently being tested throughout the development of pandas.
63+
Optional libraries below the lowest tested version may still work, but are not considered supported.
64+
65+
+-----------------+-----------------+---------+
66+
| Package | Minimum Version | Changed |
67+
+=================+=================+=========+
68+
| beautifulsoup4 | 4.6.0 | |
69+
+-----------------+-----------------+---------+
70+
| fastparquet | 0.3.2 | |
71+
+-----------------+-----------------+---------+
72+
| fsspec | 0.7.4 | |
73+
+-----------------+-----------------+---------+
74+
| gcsfs | 0.6.0 | |
75+
+-----------------+-----------------+---------+
76+
| lxml | 4.3.0 | |
77+
+-----------------+-----------------+---------+
78+
| matplotlib | 2.2.3 | |
79+
+-----------------+-----------------+---------+
80+
| numba | 0.46.0 | |
81+
+-----------------+-----------------+---------+
82+
| openpyxl | 2.6.0 | |
83+
+-----------------+-----------------+---------+
84+
| pyarrow | 0.15.0 | |
85+
+-----------------+-----------------+---------+
86+
| pymysql | 0.7.11 | |
87+
+-----------------+-----------------+---------+
88+
| pytables | 3.5.1 | |
89+
+-----------------+-----------------+---------+
90+
| s3fs | 0.4.0 | |
91+
+-----------------+-----------------+---------+
92+
| scipy | 1.2.0 | |
93+
+-----------------+-----------------+---------+
94+
| sqlalchemy | 1.2.8 | |
95+
+-----------------+-----------------+---------+
96+
| tabulate | 0.8.7 | X |
97+
+-----------------+-----------------+---------+
98+
| xarray | 0.12.0 | |
99+
+-----------------+-----------------+---------+
100+
| xlrd | 1.2.0 | |
101+
+-----------------+-----------------+---------+
102+
| xlsxwriter | 1.0.2 | |
103+
+-----------------+-----------------+---------+
104+
| xlwt | 1.3.0 | |
105+
+-----------------+-----------------+---------+
106+
| pandas-gbq | 0.12.0 | |
107+
+-----------------+-----------------+---------+
108+
109+
See :ref:`install.dependencies` and :ref:`install.optional_dependencies` for more.
41110

42111
.. _whatsnew_130.api.other:
43112

pandas/compat/_optional.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"scipy": "1.2.0",
2525
"sqlalchemy": "1.2.8",
2626
"tables": "3.5.1",
27-
"tabulate": "0.8.3",
27+
"tabulate": "0.8.7",
2828
"xarray": "0.12.3",
2929
"xlrd": "1.2.0",
3030
"xlwt": "1.3.0",

pandas/tests/io/formats/test_to_markdown.py

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ def test_simple():
1818
)
1919

2020

21+
def test_empty_frame():
22+
buf = StringIO()
23+
df = pd.DataFrame({"id": [], "first_name": [], "last_name": []}).set_index("id")
24+
df.to_markdown(buf=buf)
25+
result = buf.getvalue()
26+
assert result == (
27+
"| id | first_name | last_name |\n"
28+
"|------|--------------|-------------|"
29+
)
30+
31+
2132
def test_other_tablefmt():
2233
buf = StringIO()
2334
df = pd.DataFrame([1, 2, 3])

0 commit comments

Comments
 (0)