Skip to content

Commit cb2a0e4

Browse files
KrishnaSai2020feefladder
authored andcommitted
TST: fixed eng_formatter doctest for pandas-dev#42671 (pandas-dev#42705)
1 parent 9f1a2b2 commit cb2a0e4

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

ci/code_checks.sh

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
121121
pandas/io/parsers/ \
122122
pandas/io/sas/ \
123123
pandas/io/sql.py \
124+
pandas/io/formats/format.py \
124125
pandas/tseries/
125126
RET=$(($RET + $?)) ; echo $MSG "DONE"
126127

pandas/io/formats/format.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -1956,16 +1956,14 @@ def __call__(self, num: int | float) -> str:
19561956
"""
19571957
Formats a number in engineering notation, appending a letter
19581958
representing the power of 1000 of the original number. Some examples:
1959-
1960-
>>> format_eng(0) # for self.accuracy = 0
1959+
>>> format_eng = EngFormatter(accuracy=0, use_eng_prefix=True)
1960+
>>> format_eng(0)
19611961
' 0'
1962-
1963-
>>> format_eng(1000000) # for self.accuracy = 1,
1964-
# self.use_eng_prefix = True
1962+
>>> format_eng = EngFormatter(accuracy=1, use_eng_prefix=True)
1963+
>>> format_eng(1_000_000)
19651964
' 1.0M'
1966-
1967-
>>> format_eng("-1e-6") # for self.accuracy = 2
1968-
# self.use_eng_prefix = False
1965+
>>> format_eng = EngFormatter(accuracy=2, use_eng_prefix=False)
1966+
>>> format_eng("-1e-6")
19691967
'-1.00E-06'
19701968
19711969
@param num: the value to represent

0 commit comments

Comments
 (0)