Skip to content

Replace pandas date_range API with DatetimeIndex in tests#717

Closed
arhamchopra wants to merge 1 commit into
mainfrom
ac/fix_tests
Closed

Replace pandas date_range API with DatetimeIndex in tests#717
arhamchopra wants to merge 1 commit into
mainfrom
ac/fix_tests

Conversation

@arhamchopra

@arhamchopra arhamchopra commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Replaces pandas.date_range(...) with pandas.DatetimeIndex([...]).as_unit("ns") in two test helpers in csp/tests/adapters/test_parquet.py (test_parquet_writer and test_arrow_writer).

Reason

pandas.date_range(..., freq="1s", tz="UTC") segfaults under pandas 3.0.4 + numpy<2.5 due to a pandas._libs.tslibs offset ABI mismatch — the frequency/offset path is compiled Cython code that crashes when built against an incompatible numpy ABI. The new approach constructs the index directly from explicit datetime values, avoiding the offset code path entirely.

Equivalence

The replacement is behaviorally identical to the original:

  • Same values: start_time + 1s … start_time + 10s (10 timestamps).
  • Same dtype: datetime64[ns, UTC]. UTC is preserved because start_time is tz-aware (tzinfo=pytz.utc), and .as_unit("ns") forces nanosecond resolution.
  • Frame-level dtype and value comparisons against the read-back DataFrame match.

Both affected tests pass.

Signed-off-by: Arham Chopra <arham.chopra@cubistsystematic.com>
@arhamchopra

Copy link
Copy Markdown
Collaborator Author

Not needed pandas 3.0.4 was yanked from Pypi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants