From 94a08c2c6f3860cbcd7f80b6e681495e9d30b7c7 Mon Sep 17 00:00:00 2001 From: Arham Chopra Date: Mon, 29 Jun 2026 14:27:59 -0400 Subject: [PATCH] Replace pandas date_range API with DatetimeIndex in tests Signed-off-by: Arham Chopra --- csp/tests/adapters/test_parquet.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/csp/tests/adapters/test_parquet.py b/csp/tests/adapters/test_parquet.py index 5460a307d..98dd83250 100644 --- a/csp/tests/adapters/test_parquet.py +++ b/csp/tests/adapters/test_parquet.py @@ -205,11 +205,13 @@ def graph(): csp.run(graph, starttime=start_time) df = pandas.read_parquet(filename) expected_columns = {} - # pandas 3.0+: need to explicitly force ns unit and UTC tz, no longer the default + # Build the expected index explicitly rather than via pandas.date_range(...), + # which segfaults under pandas 3.0.4 + numpy<2.5 (tslibs offset ABI mismatch). + # This yields the same datetime64[ns, UTC] values. if timestamp_column_name: - expected_columns[timestamp_column_name] = pandas.date_range( - start=start_time + timedelta(seconds=1), periods=10, unit="ns", freq="1s", tz="UTC" - ) + expected_columns[timestamp_column_name] = pandas.DatetimeIndex( + [start_time + timedelta(seconds=i) for i in range(1, 11)] + ).as_unit("ns") expected_columns.update( { "x": list(range(1, 11)), @@ -242,10 +244,12 @@ def graph(): expected_df = pandas.DataFrame.from_dict( { - # pandas 3.0+: need to explicitly force ns unit and UTC tz, no longer the default - "timestamp": pandas.date_range( - start=start_time + timedelta(seconds=1), periods=10, unit="ns", freq="1s", tz="UTC" - ), + # Build the expected index explicitly rather than via pandas.date_range(...), + # which segfaults under pandas 3.0.4 + numpy<2.5 (tslibs offset ABI mismatch). + # This yields the same datetime64[ns, UTC] values. + "timestamp": pandas.DatetimeIndex( + [start_time + timedelta(seconds=i) for i in range(1, 11)] + ).as_unit("ns"), "x": list(range(1, 11)), "y": list(map(float, range(0, 100, 10))), }