@@ -24,20 +24,17 @@ def test_index_construct_from_list():
24
24
bf_result = bpd .Index (
25
25
[3 , 14 , 159 ], dtype = pd .Int64Dtype (), name = "my_index"
26
26
).to_pandas ()
27
- # TODO(b/340878489): fix type error
28
- pd_result = pd .Index ([3 , 14 , 159 ], dtype = pd .Int64Dtype (), name = "my_index" ) # type: ignore
27
+ pd_result : pd .Index = pd .Index ([3 , 14 , 159 ], dtype = pd .Int64Dtype (), name = "my_index" )
29
28
pd .testing .assert_index_equal (bf_result , pd_result )
30
29
31
30
32
31
def test_index_construct_from_series ():
33
- # TODO(b/340878489): fix type error
34
32
bf_result = bpd .Index (
35
33
bpd .Series ([3 , 14 , 159 ], dtype = pd .Float64Dtype (), name = "series_name" ),
36
34
name = "index_name" ,
37
35
dtype = pd .Int64Dtype (),
38
- ).to_pandas () # type: ignore
39
- # TODO(b/340878489): fix type error
40
- pd_result = pd .Index ( # type: ignore
36
+ ).to_pandas ()
37
+ pd_result : pd .Index = pd .Index (
41
38
pd .Series ([3 , 14 , 159 ], dtype = pd .Float64Dtype (), name = "series_name" ),
42
39
name = "index_name" ,
43
40
dtype = pd .Int64Dtype (),
@@ -49,14 +46,15 @@ def test_index_construct_from_index():
49
46
bf_index_input = bpd .Index (
50
47
[3 , 14 , 159 ], dtype = pd .Float64Dtype (), name = "series_name"
51
48
)
52
- # TODO(b/340878489): fix type error
53
49
bf_result = bpd .Index (
54
- bf_index_input , dtype = pd .Int64Dtype (), name = "index_name" # type: ignore
50
+ bf_index_input , dtype = pd .Int64Dtype (), name = "index_name"
55
51
).to_pandas ()
56
- # TODO(b/340878489): fix type error
57
- pd_index_input = pd .Index ([3 , 14 , 159 ], dtype = pd .Float64Dtype (), name = "series_name" ) # type: ignore
58
- # TODO(b/340878489): fix type error
59
- pd_result = pd .Index (pd_index_input , dtype = pd .Int64Dtype (), name = "index_name" ) # type: ignore
52
+ pd_index_input : pd .Index = pd .Index (
53
+ [3 , 14 , 159 ], dtype = pd .Float64Dtype (), name = "series_name"
54
+ )
55
+ pd_result : pd .Index = pd .Index (
56
+ pd_index_input , dtype = pd .Int64Dtype (), name = "index_name"
57
+ )
60
58
pd .testing .assert_index_equal (bf_result , pd_result )
61
59
62
60
@@ -365,17 +363,16 @@ def test_index_drop_duplicates(scalars_df_index, scalars_pandas_df_index, keep):
365
363
366
364
367
365
def test_index_isin (scalars_df_index , scalars_pandas_df_index ):
366
+ col_name = "int64_col"
368
367
bf_series = (
369
- scalars_df_index .set_index ("int64_col" ).index .isin ([2 , 55555 , 4 ]).to_pandas ()
368
+ scalars_df_index .set_index (col_name ).index .isin ([2 , 55555 , 4 ]).to_pandas ()
370
369
)
371
- pd_result_array = scalars_pandas_df_index .set_index ("int64_col" ).index .isin (
370
+ pd_result_array = scalars_pandas_df_index .set_index (col_name ).index .isin (
372
371
[2 , 55555 , 4 ]
373
372
)
374
- # TODO(b/340878489): fix type error
375
- pd .testing .assert_index_equal ( # type: ignore
376
- pd .Index (pd_result_array ),
373
+ pd .testing .assert_index_equal (
374
+ pd .Index (pd_result_array ).set_names (col_name ),
377
375
bf_series ,
378
- check_names = False ,
379
376
)
380
377
381
378
0 commit comments