Skip to content

Commit 677a27d

Browse files
committed
MAINT: Address reviewer comments
* Move whatsnew to 0.21.1.txt * Empty tests for empty DataFrame in to_latex
1 parent 60a4fc8 commit 677a27d

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

doc/source/whatsnew/v0.21.0.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,6 @@ I/O
10891089
- Bug in :meth:`DataFrame.to_html` in which there was no validation of the ``justify`` parameter (:issue:`17527`)
10901090
- Bug in :func:`HDFStore.select` when reading a contiguous mixed-data table featuring VLArray (:issue:`17021`)
10911091
- Bug in :func:`to_json` where several conditions (including objects with unprintable symbols, objects with deep recursion, overlong labels) caused segfaults instead of raising the appropriate exception (:issue:`14256`)
1092-
- Bug in :meth:`DataFrame.to_latex` with ``longtable=True`` where a latex multicolumn always spanned over three columns (:issue:`17959`)
10931092

10941093
Plotting
10951094
^^^^^^^^

doc/source/whatsnew/v0.21.1.txt

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ I/O
127127
- Bug in :func:`pandas.io.json.json_normalize` to avoid modification of ``meta`` (:issue:`18610`)
128128
- Bug in :func:`to_latex` where repeated multi-index values were not printed even though a higher level index differed from the previous row (:issue:`14484`)
129129
- Bug when reading NaN-only categorical columns in :class:`HDFStore` (:issue:`18413`)
130+
- Bug in :meth:`DataFrame.to_latex` with ``longtable=True`` where a latex multicolumn always spanned over three columns (:issue:`17959`)
130131

131132
Plotting
132133
^^^^^^^^

pandas/tests/io/formats/test_to_latex.py

+23
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,29 @@ def test_to_latex_format(self, frame):
9191

9292
assert withindex_result == withindex_expected
9393

94+
def test_to_latex_empty(self):
95+
df = DataFrame()
96+
result = df.to_latex()
97+
expected = r"""\begin{tabular}{l}
98+
\toprule
99+
Empty DataFrame
100+
Columns: Index([], dtype='object')
101+
Index: Index([], dtype='object') \\
102+
\bottomrule
103+
\end{tabular}
104+
"""
105+
assert result == expected
106+
107+
result = df.to_latex(longtable=True)
108+
expected = r"""\begin{longtable}{l}
109+
\toprule
110+
Empty DataFrame
111+
Columns: Index([], dtype='object')
112+
Index: Index([], dtype='object') \\
113+
\end{longtable}
114+
"""
115+
assert result == expected
116+
94117
def test_to_latex_with_formatters(self):
95118
df = DataFrame({'int': [1, 2, 3],
96119
'float': [1.0, 2.0, 3.0],

0 commit comments

Comments
 (0)