Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: to_latex(filename) truncates #41388

Closed
2 of 3 tasks
michaelaye opened this issue May 9, 2021 · 2 comments · Fixed by #40422
Closed
2 of 3 tasks

BUG: to_latex(filename) truncates #41388

michaelaye opened this issue May 9, 2021 · 2 comments · Fixed by #40422
Labels
Bug Duplicate Report Duplicate issue or pull request IO LaTeX to_latex
Milestone

Comments

@michaelaye
Copy link
Contributor

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Code Sample, a copy-pastable example

# Your code here
import pandas as pd
df = pd.DataFrame(
    {
        "Node": ["Atmosphere"],
        "Description": [
            "The Planetary Atmospheres Node (ATM) is responsible for the acquisition, preservation, and distribution of all non-imaging atmospheric data from NASA's planetary missions, including higher-order products derived from those data. In addition to providing user consultation, the node makes available a number of tools and services supporting researchers."
        ],
    }
)
df.to_latex('table.tex')

output created:

$ cat table.tex                                                                              (py39)
\begin{tabular}{lll}
\toprule
{} &        Node &                                                                                          Description \\
\midrule
0 &  Atmosphere &  The Planetary Atmospheres Node (ATM) is responsible for the acquisition, preservation, and distr... \\
\bottomrule
\end{tabular}

Problem description

According to what I have read in previous issues about to_latex(), it should not truncate by default for the file output (and it would be a bad API if it would).

Expected Output

A complete table in the output tex file.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : 2cb9652
python : 3.8.8.final.0
python-bits : 64
OS : Darwin
OS-release : 19.6.0
Version : Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.2.4
numpy : 1.20.2
pytz : 2021.1
dateutil : 2.8.1
pip : 21.1.1
setuptools : 49.6.0.post20210108
Cython : 0.29.23
pytest : 6.2.4
hypothesis : None
sphinx : 3.5.4
blosc : None
feather : None
xlsxwriter : 1.4.2
lxml.etree : 4.6.3
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.3
IPython : 7.23.1
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : 2021.04.0
fastparquet : None
gcsfs : None
matplotlib : 3.4.2
numexpr : 2.7.3
odfpy : None
openpyxl : 3.0.7
pandas_gbq : None
pyarrow : 4.0.0
pyxlsb : None
s3fs : None
scipy : 1.6.3
sqlalchemy : None
tables : 3.6.1
tabulate : None
xarray : 0.18.0
xlrd : 2.0.1
xlwt : 1.3.0
numba : 0.53.1

@michaelaye michaelaye added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels May 9, 2021
@michaelaye
Copy link
Contributor Author

oh, it might be a duplicate of this 7 year old thing? #6491

@michaelaye
Copy link
Contributor Author

michaelaye commented May 9, 2021

Workaround still works, but I stand by that this is a bad, user-unexpected API, requiring this extra step:

with pd.option_context("max_colwidth", 1000):
    df.to_latex('table.tex')

@attack68 attack68 added IO LaTeX to_latex Duplicate Report Duplicate issue or pull request and removed Needs Triage Issue that has not been reviewed by a pandas team member labels May 9, 2021
@jreback jreback added this to the 1.3 milestone May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Duplicate Report Duplicate issue or pull request IO LaTeX to_latex
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants