Skip to content

DataFrame.to_latex() should honor na_rep after formatter. #9046

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

Closed
moorepants opened this issue Dec 8, 2014 · 1 comment · Fixed by #36690
Closed

DataFrame.to_latex() should honor na_rep after formatter. #9046

moorepants opened this issue Dec 8, 2014 · 1 comment · Fixed by #36690
Labels
Bug IO LaTeX to_latex Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Milestone

Comments

@moorepants
Copy link

In the example below I would expect that 'np.nan' would be replaced by 'aaah'.

In [3]: df = pd.DataFrame({'a': np.arange(3), 'b': [0.1, np.nan, 0.2]})

In [4]: df
Out[4]: 
   a    b
0  0  0.1
1  1  NaN
2  2  0.2

In [5]: print(df.to_latex(formatters={'b': lambda x: '{:0.4f}'.format(x)}, na_rep='aaah'))
\begin{tabular}{lrr}
\toprule
{} &  a &      b \\
\midrule
0 &  0 & 0.1000 \\
1 &  1 &    nan \\
2 &  2 & 0.2000 \\
\bottomrule
\end{tabular}
@jreback jreback added the Output-Formatting __repr__ of pandas objects, to_string label Dec 8, 2014
@jreback jreback added this to the 0.16.0 milestone Dec 8, 2014
@jreback jreback added the Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate label Dec 8, 2014
@jreback
Copy link
Contributor

jreback commented Dec 8, 2014

this is not implemented AFAICT. pull-requests are welcomed.

@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015
@jorisvandenbossche jorisvandenbossche added IO LaTeX to_latex and removed Output-Formatting __repr__ of pandas objects, to_string labels Aug 22, 2015
@gfyoung gfyoung added the Bug label Mar 25, 2019
@jreback jreback modified the milestones: Contributions Welcome, 1.2 Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO LaTeX to_latex Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
4 participants