Skip to content

Commit 8596e7c

Browse files
author
AntonioAndraues
committed
fix test and resolve whats new conflit
1 parent e74e5cb commit 8596e7c

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

doc/source/whatsnew/v1.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ Other
371371
- Bug in :meth:`Series.diff` where a boolean series would incorrectly raise a ``TypeError`` (:issue:`17294`)
372372
- :meth:`Series.append` will no longer raise a ``TypeError`` when passed a tuple of ``Series`` (:issue:`28410`)
373373
- Fix corrupted error message when calling ``pandas.libs._json.encode()`` on a 0d array (:issue:`18878`)
374+
- Bug in :meth:`pandas.io.formats.style.Styler` formatting for floating values not displaying decimals correctly (:issue:`13257`)
374375

375376
.. _whatsnew_1000.contributors:
376377

pandas/tests/io/formats/test_style.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -1189,22 +1189,18 @@ def test_display_subset(self):
11891189
{"a": "{:0.1f}", "b": "{0:.2%}"}, subset=pd.IndexSlice[0, :]
11901190
)._translate()
11911191
expected = "0.1"
1192-
assert ctx["body"][0][1]["display_value"] == expected
1193-
assert ctx["body"][1][1]["display_value"] == "1.1234"
1194-
assert ctx["body"][0][2]["display_value"] == "12.34%"
1195-
1196-
raw_11 = "1.1234"
1197-
ctx = df.style.format("{:0.1f}", subset=pd.IndexSlice[0, :])._translate()
1192+
raw_11 = "1.123400"
11981193
assert ctx["body"][0][1]["display_value"] == expected
11991194
assert ctx["body"][1][1]["display_value"] == raw_11
1200-
1195+
assert ctx["body"][0][2]["display_value"] == "12.34%"
1196+
12011197
ctx = df.style.format("{:0.1f}", subset=pd.IndexSlice[0, :])._translate()
12021198
assert ctx["body"][0][1]["display_value"] == expected
12031199
assert ctx["body"][1][1]["display_value"] == raw_11
12041200

12051201
ctx = df.style.format("{:0.1f}", subset=pd.IndexSlice["a"])._translate()
12061202
assert ctx["body"][0][1]["display_value"] == expected
1207-
assert ctx["body"][0][2]["display_value"] == "0.1234"
1203+
assert ctx["body"][0][2]["display_value"] == "0.123400"
12081204

12091205
ctx = df.style.format("{:0.1f}", subset=pd.IndexSlice[0, "a"])._translate()
12101206
assert ctx["body"][0][1]["display_value"] == expected
@@ -1215,8 +1211,8 @@ def test_display_subset(self):
12151211
)._translate()
12161212
assert ctx["body"][0][1]["display_value"] == expected
12171213
assert ctx["body"][1][1]["display_value"] == "1.1"
1218-
assert ctx["body"][0][2]["display_value"] == "0.1234"
1219-
assert ctx["body"][1][2]["display_value"] == "1.1234"
1214+
assert ctx["body"][0][2]["display_value"] == "0.123400"
1215+
assert ctx["body"][1][2]["display_value"] == raw_11
12201216

12211217
def test_display_dict(self):
12221218
df = pd.DataFrame([[0.1234, 0.1234], [1.1234, 1.1234]], columns=["a", "b"])

0 commit comments

Comments
 (0)