From 270b068659467bd01dfb1e277d976c12b7a87097 Mon Sep 17 00:00:00 2001 From: Samesh Date: Wed, 7 Aug 2019 15:33:20 +0530 Subject: [PATCH 1/4] DOC:add print statement in to_latex example changed `df.to_latex` to `print(df.to_latex)` closes #27789 --- pandas/core/generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 1b39f9225a0ed..d761f4a111edb 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -2993,7 +2993,7 @@ def to_latex( >>> df = pd.DataFrame({'name': ['Raphael', 'Donatello'], ... 'mask': ['red', 'purple'], ... 'weapon': ['sai', 'bo staff']}) - >>> df.to_latex(index=False) # doctest: +NORMALIZE_WHITESPACE + >>> print(df.to_latex(index=False)) # doctest: +NORMALIZE_WHITESPACE '\\begin{tabular}{lll}\n\\toprule\n name & mask & weapon \\\\\n\\midrule\n Raphael & red & sai \\\\\n Donatello & purple & bo staff \\\\\n\\bottomrule\n\\end{tabular}\n' From 06976e3b99f6465cf61d73322c6d78a2b03a942f Mon Sep 17 00:00:00 2001 From: Samesh Date: Wed, 7 Aug 2019 18:00:46 +0530 Subject: [PATCH 2/4] fix doc test failure replaced old example with new updated example --- pandas/core/generic.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index d761f4a111edb..02979a339672b 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -2994,9 +2994,16 @@ def to_latex( ... 'mask': ['red', 'purple'], ... 'weapon': ['sai', 'bo staff']}) >>> print(df.to_latex(index=False)) # doctest: +NORMALIZE_WHITESPACE - '\\begin{tabular}{lll}\n\\toprule\n name & mask & weapon - \\\\\n\\midrule\n Raphael & red & sai \\\\\n Donatello & - purple & bo staff \\\\\n\\bottomrule\n\\end{tabular}\n' + '\begin{tabular}{lll} + \toprule + name & mask & weapon \\ + \midrule + Raphael & red & sai \\ + Donatello & purple & bo staff \\ + \bottomrule + \end{tabular} + + ' """ # Get defaults from the pandas config if self.ndim == 1: From 3aaf69f85d43ca26356b4f0a54d8481faf79bac0 Mon Sep 17 00:00:00 2001 From: Samesh Date: Wed, 7 Aug 2019 18:18:56 +0530 Subject: [PATCH 3/4] removed extra single quote character --- pandas/core/generic.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 02979a339672b..bab64111e64eb 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -2994,7 +2994,7 @@ def to_latex( ... 'mask': ['red', 'purple'], ... 'weapon': ['sai', 'bo staff']}) >>> print(df.to_latex(index=False)) # doctest: +NORMALIZE_WHITESPACE - '\begin{tabular}{lll} + \begin{tabular}{lll} \toprule name & mask & weapon \\ \midrule @@ -3003,7 +3003,6 @@ def to_latex( \bottomrule \end{tabular} - ' """ # Get defaults from the pandas config if self.ndim == 1: From 0081edd00752272678d59283540236c80d297969 Mon Sep 17 00:00:00 2001 From: Samesh Date: Wed, 7 Aug 2019 18:40:06 +0530 Subject: [PATCH 4/4] fix formatting issues --- pandas/core/generic.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index bab64111e64eb..0ddb863fa9402 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -2999,10 +2999,9 @@ def to_latex( name & mask & weapon \\ \midrule Raphael & red & sai \\ - Donatello & purple & bo staff \\ + Donatello & purple & bo staff \\ \bottomrule \end{tabular} - """ # Get defaults from the pandas config if self.ndim == 1: