@@ -1144,18 +1144,7 @@ def test_timedelta64_analytics(self):
1144
1144
expected = Timedelta ("1 days" )
1145
1145
assert result == expected
1146
1146
1147
- @pytest .mark .parametrize (
1148
- "test_input,error_type" ,
1149
- [
1150
- (Series ([], dtype = "float64" ), ValueError ),
1151
- # For strings, or any Series with dtype 'O'
1152
- (Series (["foo" , "bar" , "baz" ]), TypeError ),
1153
- (Series ([(1 ,), (2 ,)]), TypeError ),
1154
- # For mixed data types
1155
- (Series (["foo" , "foo" , "bar" , "bar" , None , np .nan , "baz" ]), TypeError ),
1156
- ],
1157
- )
1158
- def test_assert_idxminmax_empty_raises (self , test_input , error_type ):
1147
+ def test_assert_idxminmax_empty_raises (self ):
1159
1148
"""
1160
1149
Cases where ``Series.argmax`` and related should raise an exception
1161
1150
"""
@@ -1294,13 +1283,14 @@ def test_minmax_nat_series(self, nat_ser):
1294
1283
@pytest .mark .parametrize (
1295
1284
"nat_df" ,
1296
1285
[
1297
- DataFrame ( [NaT , NaT ]) ,
1298
- DataFrame ( [NaT , Timedelta ("nat" )]) ,
1299
- DataFrame ( [Timedelta ("nat" ), Timedelta ("nat" )]) ,
1286
+ [NaT , NaT ],
1287
+ [NaT , Timedelta ("nat" )],
1288
+ [Timedelta ("nat" ), Timedelta ("nat" )],
1300
1289
],
1301
1290
)
1302
1291
def test_minmax_nat_dataframe (self , nat_df ):
1303
1292
# GH#23282
1293
+ nat_df = DataFrame (nat_df )
1304
1294
assert nat_df .min ()[0 ] is NaT
1305
1295
assert nat_df .max ()[0 ] is NaT
1306
1296
assert nat_df .min (skipna = False )[0 ] is NaT
@@ -1399,14 +1389,10 @@ class TestSeriesMode:
1399
1389
# were moved from a series-specific test file, _not_ that these tests are
1400
1390
# intended long-term to be series-specific
1401
1391
1402
- @pytest .mark .parametrize (
1403
- "dropna, expected" ,
1404
- [(True , Series ([], dtype = np .float64 )), (False , Series ([], dtype = np .float64 ))],
1405
- )
1406
- def test_mode_empty (self , dropna , expected ):
1392
+ def test_mode_empty (self , dropna ):
1407
1393
s = Series ([], dtype = np .float64 )
1408
1394
result = s .mode (dropna )
1409
- tm .assert_series_equal (result , expected )
1395
+ tm .assert_series_equal (result , s )
1410
1396
1411
1397
@pytest .mark .parametrize (
1412
1398
"dropna, data, expected" ,
@@ -1619,23 +1605,24 @@ def test_mode_boolean_with_na(self):
1619
1605
[
1620
1606
(
1621
1607
[0 , 1j , 1 , 1 , 1 + 1j , 1 + 2j ],
1622
- Series ( [1 ], dtype = np . complex128 ) ,
1608
+ [1 ],
1623
1609
np .complex128 ,
1624
1610
),
1625
1611
(
1626
1612
[0 , 1j , 1 , 1 , 1 + 1j , 1 + 2j ],
1627
- Series ( [1 ], dtype = np . complex64 ) ,
1613
+ [1 ],
1628
1614
np .complex64 ,
1629
1615
),
1630
1616
(
1631
1617
[1 + 1j , 2j , 1 + 1j ],
1632
- Series ( [1 + 1j ], dtype = np . complex128 ) ,
1618
+ [1 + 1j ],
1633
1619
np .complex128 ,
1634
1620
),
1635
1621
],
1636
1622
)
1637
1623
def test_single_mode_value_complex (self , array , expected , dtype ):
1638
1624
result = Series (array , dtype = dtype ).mode ()
1625
+ expected = Series (expected , dtype = dtype )
1639
1626
tm .assert_series_equal (result , expected )
1640
1627
1641
1628
@pytest .mark .parametrize (
@@ -1644,12 +1631,12 @@ def test_single_mode_value_complex(self, array, expected, dtype):
1644
1631
(
1645
1632
# no modes
1646
1633
[0 , 1j , 1 , 1 + 1j , 1 + 2j ],
1647
- Series ( [0j , 1j , 1 + 0j , 1 + 1j , 1 + 2j ], dtype = np . complex128 ) ,
1634
+ [0j , 1j , 1 + 0j , 1 + 1j , 1 + 2j ],
1648
1635
np .complex128 ,
1649
1636
),
1650
1637
(
1651
1638
[1 + 1j , 2j , 1 + 1j , 2j , 3 ],
1652
- Series ( [2j , 1 + 1j ], dtype = np . complex64 ) ,
1639
+ [2j , 1 + 1j ],
1653
1640
np .complex64 ,
1654
1641
),
1655
1642
],
@@ -1659,4 +1646,5 @@ def test_multimode_complex(self, array, expected, dtype):
1659
1646
# mode tries to sort multimodal series.
1660
1647
# Complex numbers are sorted by their magnitude
1661
1648
result = Series (array , dtype = dtype ).mode ()
1649
+ expected = Series (expected , dtype = dtype )
1662
1650
tm .assert_series_equal (result , expected )
0 commit comments