@@ -96,14 +96,17 @@ def test_streamset_arrow_windows_vs_windows(conn, tmp_collection, name_callable)
9696 .windows (width = btrdb .utils .timez .ns_delta (nanoseconds = 10 ))
9797 )
9898 values_arrow = ss .arrow_to_dataframe (name_callable = name_callable )
99+ values_arrow .set_index ("time" , inplace = True )
100+ values_arrow .index = pd .DatetimeIndex (values_arrow .index )
99101 values_prev = ss .to_dataframe (name_callable = name_callable ).convert_dtypes (
100102 dtype_backend = "pyarrow"
101103 )
102- values_prev .index = pd .DatetimeIndex (values_prev .index , tz = "UTC" )
104+ values_prev .index = pd .to_datetime (values_prev .index , utc = True )
105+ values_prev = values_prev .convert_dtypes (
106+ dtype_backend = "pyarrow" ,
107+ )
103108 col_map = {old_col : old_col + "/mean" for old_col in values_prev .columns }
104109 values_prev = values_prev .rename (columns = col_map )
105- (values_arrow )
106- (values_prev )
107110 assert values_arrow .equals (values_prev )
108111
109112
@@ -125,6 +128,8 @@ def test_streamset_arrow_windows_vs_windows_agg_all(conn, tmp_collection):
125128 .windows (width = btrdb .utils .timez .ns_delta (nanoseconds = 10 ))
126129 )
127130 values_arrow = ss .arrow_to_dataframe (name_callable = None , agg = ["all" ])
131+ values_arrow .set_index ("time" , inplace = True )
132+ values_arrow .index = pd .DatetimeIndex (values_arrow .index )
128133 values_prev = ss .to_dataframe (name_callable = None , agg = "all" )
129134 values_prev = values_prev .apply (lambda x : x .astype (str (x .dtype ) + "[pyarrow]" ))
130135 values_prev = values_prev .apply (
@@ -145,7 +150,12 @@ def test_streamset_arrow_windows_vs_windows_agg_all(conn, tmp_collection):
145150 agg = ["all" , "mean" , "trash" ], name_callable = lambda x : str (x .uuid )
146151 )
147152 assert (
148- len (other_arrow_df .filter (regex = "[min,mean,max,count,stddev]" ).columns ) == 3 * 5
153+ len (
154+ other_arrow_df .filter (
155+ regex = ".*\/[min,mean,max,count,stddev]" , axis = 1
156+ ).columns
157+ )
158+ == 3 * 5
149159 )
150160
151161
@@ -174,6 +184,8 @@ def test_streamset_arrow_aligned_windows_vs_aligned_windows(
174184 .windows (width = btrdb .utils .general .pointwidth .from_nanoseconds (10 ))
175185 )
176186 values_arrow = ss .arrow_to_dataframe (name_callable = name_callable )
187+ values_arrow .set_index ("time" , inplace = True )
188+ values_arrow .index = pd .DatetimeIndex (values_arrow .index )
177189 values_prev = ss .to_dataframe (
178190 name_callable = name_callable
179191 ) # .convert_dtypes(dtype_backend='pyarrow')
@@ -235,6 +247,7 @@ def test_arrow_streamset_to_dataframe(conn, tmp_collection):
235247 s2 .insert (list (zip (t2 , d2 )))
236248 ss = btrdb .stream .StreamSet ([s1 , s2 ]).filter (start = 100 , end = 121 )
237249 values = ss .arrow_to_dataframe ()
250+ values .set_index ("time" , inplace = True )
238251 expected_times = [100 , 101 , 105 , 106 , 110 , 114 , 115 , 119 , 120 ]
239252 expected_times = [
240253 pa .scalar (v , type = pa .timestamp ("ns" , tz = "UTC" )).as_py () for v in expected_times
@@ -385,6 +398,8 @@ def test_streamset_windows_aggregates_filter(conn, tmp_collection):
385398 .windows (width = btrdb .utils .timez .ns_delta (nanoseconds = 10 ))
386399 )
387400 values_arrow_df = ss .arrow_to_dataframe (agg = ["mean" , "stddev" ])
401+ values_arrow_df .set_index ("time" , inplace = True )
402+ values_arrow_df .index = pd .DatetimeIndex (values_arrow_df .index )
388403 values_non_arrow_df = ss .to_dataframe (agg = "all" )
389404 values_non_arrow_df .index = pd .DatetimeIndex (values_non_arrow_df .index , tz = "UTC" )
390405 values_non_arrow_df = values_non_arrow_df .apply (
0 commit comments