Skip to content

Commit 93d5565

Browse files
author
KrishnaSai2020
committed
doctest fix for pandas-dev#42670
1 parent a340b16 commit 93d5565

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

pandas/io/formats/format.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,17 +1955,17 @@ def __init__(self, accuracy: int | None = None, use_eng_prefix: bool = False):
19551955
def __call__(self, num: int | float) -> str:
19561956
"""
19571957
Formats a number in engineering notation, appending a letter
1958-
representing the power of 1000 of the original number. Some examples:
1959-
>>> format_eng = EngFormatter()
1960-
>>> format_eng(0) # for self.accuracy = 0
1958+
representing the power of 10 of the original number. Some examples:
1959+
>>> format_eng = EngFormatter(0)
1960+
>>> format_eng(0)
19611961
' 0'
1962+
>>> format_eng = EngFormatter(1, True )
1963+
>>> format_eng(1000000)
19621964
1963-
>>> format_eng(1000000) # for self.accuracy = 1,
1964-
# self.use_eng_prefix = True
19651965
' 1.0M'
1966+
>>> format_eng = EngFormatter(2, False)
1967+
>>> format_eng("-1e-6")
19661968
1967-
>>> format_eng("-1e-6") # for self.accuracy = 2
1968-
# self.use_eng_prefix = False
19691969
'-1.00E-06'
19701970
19711971
@param num: the value to represent
@@ -1983,9 +1983,6 @@ def __call__(self, num: int | float) -> str:
19831983
return "inf"
19841984

19851985
sign = 1
1986-
if dnum == 0:
1987-
formatted = ' 0'
1988-
return formatted
19891986

19901987
if dnum < 0: # pragma: no cover
19911988
sign = -1

0 commit comments

Comments
 (0)