You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on issue #12031 (adding a decimal parameter to .to_latex() and .to_html()), I realized a solution would be pretty straight-forward if only FloatArrayFormatter was a bit cleaned.
Currently, there are two methods that do a similar work:
.get_formatted_data(), which returns the array with its float values converted to strings using the parameters given at initialisation.
.get_result(), which does something similar, but with a fixed-width output suitable for screen printing.
The two methods don't share any piece of code.
(The first method can already deal with a decimal parameter. The second cannot, and it is the one used by .to_latex.)
This is in part my fault, since my pull request #11681 could have been more factorized.
Anyway, I'm volunteering to do a PR.
The text was updated successfully, but these errors were encountered:
In [1]: s = Series([1,2,3],np.arange(3.))
In [2]: s
Out[2]:
0 1
1 2
2 3
dtype: int64
In [3]: s.index
Out[3]: Float64Index([0.0, 1.0, 2.0], dtype='float64')
In [4]: s = Series([1,2,3],np.arange(3.)+.01)
In [5]: s
Out[5]:
0.01 1
1.01 2
2.01 3
dtype: int64
In [6]: s.index
Out[6]: Float64Index([0.01, 1.01, 2.01], dtype='float64')
This is misleading and [2] index should prob be format with a single decimal place
eg 1.0 to make it obvious this is a Float64Index.
the _trim_zeros function is a bit aggressive here.
While working on issue #12031 (adding a
decimal
parameter to.to_latex()
and.to_html()
), I realized a solution would be pretty straight-forward if onlyFloatArrayFormatter
was a bit cleaned.Currently, there are two methods that do a similar work:
.get_formatted_data()
, which returns the array with its float values converted to strings using the parameters given at initialisation..get_result()
, which does something similar, but with a fixed-width output suitable for screen printing.The two methods don't share any piece of code.
(The first method can already deal with a
decimal
parameter. The second cannot, and it is the one used by.to_latex
.)This is in part my fault, since my pull request #11681 could have been more factorized.
Anyway, I'm volunteering to do a PR.
The text was updated successfully, but these errors were encountered: