Skip to content

Make export_to_pandas output independent of the pandas version - #67

Merged
federicadonald merged 1 commit into
masterfrom
fix-export-to-pandas-timedelta-format
Oct 27, 2026
Merged

federicadonald merged 1 commit into
masterfrom
fix-export-to-pandas-timedelta-format

Conversation

@federicadonald

Copy link
Copy Markdown
Contributor

The Python leg of the e2e run started failing on export_to_pandas:

[DIFF] output differs from golden
  => 36000000000000               36000.00                 20.0 0 days 10:00:00.000000
  <= 36000000000000               36000.00                 20.0        0 days 10:00:00

Cause

pandas 3.1.0 changed how a timedelta column is displayed. Every value is now padded to microseconds (0 days 10:00:00.000000); 2.x and 3.0.x print whole seconds as 0 days 10:00:00. The CI agent installs pandas unpinned, so it picked up 3.1.0. SQL Race output is unaffected.

Fix

Print the time column with str() per Timedelta (to_string(..., formatters={"time": str})). That gives the same text on every pandas version, so customers on any pandas see the documented output, and the golden file stays unchanged.

Testing

The printed head of the DataFrame matches tests/golden/Python/export_to_pandas.txt exactly on pandas 2.3.3, 3.0.6 and 3.1.0. Without the change, 3.1.0 reproduces the CI diff. I tested with an equivalent DataFrame (same timestamps and values), not by running the snippet against a SQL Race session.

pandas 3.1.0 changed how a timedelta column is displayed: every value is
now padded to microseconds (0 days 10:00:00.000000), where 2.x and 3.0.x
print whole seconds as 0 days 10:00:00. The e2e runner installs pandas
unpinned, so the Python leg started failing against the golden output.

Format the time column with str() per Timedelta, which gives the same
text on pandas 2.3.3, 3.0.6 and 3.1.0 and matches the existing golden
file unchanged.
@federicadonald
federicadonald merged commit 8e237c5 into master Oct 27, 2026
1 check passed
@federicadonald
federicadonald deleted the fix-export-to-pandas-timedelta-format branch October 27, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants