fix(excel export): big number truncation handling (#32739)

This commit is contained in:
CharlesNkdl
2025-03-21 17:39:59 +01:00
committed by GitHub
parent 9bb3a5782d
commit c0f83a7467
2 changed files with 38 additions and 0 deletions

View File

@@ -105,3 +105,27 @@ def test_column_data_types_with_failing_conversion():
assert not is_numeric_dtype(df["col1"])
assert not is_numeric_dtype(df["col2"])
assert not is_numeric_dtype(df["col3"])
def test_column_data_types_with_large_numeric_values():
df = pd.DataFrame(
{
"big_number": [
10**14,
999999999999999,
10**15 + 1,
10**16,
1100108628127863,
2**54,
],
}
)
apply_column_types(df, [GenericDataType.NUMERIC])
assert df["big_number"].tolist() == [
100000000000000,
999999999999999,
"1000000000000001",
"10000000000000000",
"1100108628127863",
"18014398509481984",
]