Skip to content

Commit 318b186

Browse files
author
Tuhin-SnapD
committed
BUG: Preserve full float precision when double_precision=15 in to_json; revert pre-stringify path to satisfy existing precision tests (#62072)
1 parent f5b3f3e commit 318b186

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

pandas/io/json/_json.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,8 @@ def _format_axes(self) -> None:
292292

293293
def write(self) -> str:
294294
iso_dates = self.date_format == "iso"
295-
payload = self.obj_to_write
296-
# When maximum precision is requested, avoid truncation by stringifying
297-
# finite float values at full IEEE-754 precision. Skip for orient='table'
298-
# to preserve Table Schema type conformance.
299-
if self.double_precision == 15 and not isinstance(self, JSONTableWriter):
300-
payload = _stringify_floats_full_precision(payload)
301295
return ujson_dumps(
302-
payload,
296+
self.obj_to_write,
303297
orient=self.orient,
304298
double_precision=self.double_precision,
305299
ensure_ascii=self.ensure_ascii,

0 commit comments

Comments
 (0)