File tree Expand file tree Collapse file tree 2 files changed +11
-14
lines changed Expand file tree Collapse file tree 2 files changed +11
-14
lines changed Original file line number Diff line number Diff line change 25
25
import warnings
26
26
27
27
import numpy as np
28
- import numba
29
28
30
29
from pandas ._libs import (
31
30
lib ,
@@ -5424,14 +5423,14 @@ def isnull(self) -> Series:
5424
5423
"""
5425
5424
return super ().isnull ()
5426
5425
5427
- def isconstant (self , dropna = False ):
5426
+ def isconstant (self , dropna = False ):
5428
5427
"""
5429
5428
Return if the series has constant values.
5430
5429
5431
5430
Parameters
5432
5431
----------
5433
5432
dropna : bool, default False
5434
- If True, NaN values will be ignored. If False, NaN values will be considered
5433
+ If True, NaN values will be ignored. If False, NaN values will be considered
5435
5434
in the determination of whether the series has constant values.
5436
5435
5437
5436
Returns
@@ -5462,7 +5461,7 @@ def isconstant(self, dropna = False):
5462
5461
v = remove_na_arraylike (v )
5463
5462
if v .shape [0 ] == 0 or not notna (v ).any ():
5464
5463
return True
5465
- return (v [0 ] == v ).all ()
5464
+ return (v [0 ] == v ).all ()
5466
5465
5467
5466
# error: Cannot determine type of 'notna'
5468
5467
@doc (NDFrame .notna , klass = _shared_doc_kwargs ["klass" ]) # type: ignore[has-type]
Original file line number Diff line number Diff line change 1
1
import numpy as np
2
- import pytest
3
2
4
- from pandas import (
5
- Series ,
6
- )
3
+ from pandas import Series
4
+
7
5
8
6
class TestSeriesIsConstant :
9
7
def test_isconstant (self ):
@@ -28,11 +26,11 @@ def test_isconstant_with_nan(self):
28
26
result = s .isconstant ()
29
27
assert result
30
28
31
- s = Series ([np .nan ,np .nan ])
29
+ s = Series ([np .nan , np .nan ])
32
30
result = s .isconstant ()
33
31
assert result
34
32
35
- s = Series ([np .nan ,1 ])
33
+ s = Series ([np .nan , 1 ])
36
34
result = s .isconstant ()
37
35
assert not result
38
36
@@ -45,11 +43,11 @@ def test_isconstant_with_nan_dropna(self):
45
43
result = s .isconstant (True )
46
44
assert result
47
45
48
- s = Series ([np .nan ,np .nan ])
46
+ s = Series ([np .nan , np .nan ])
49
47
result = s .isconstant (True )
50
48
assert result
51
49
52
- s = Series ([np .nan ,1 ])
50
+ s = Series ([np .nan , 1 ])
53
51
result = s .isconstant (True )
54
52
assert result
55
53
@@ -58,10 +56,10 @@ def test_isconstant_with_nan_dropna(self):
58
56
assert result
59
57
60
58
def test_isconstant_mixed_types (self ):
61
- s = Series ([2 , '2' , 2 ])
59
+ s = Series ([2 , "2" , 2 ])
62
60
result = s .isconstant ()
63
61
assert not result
64
62
65
63
s = Series ([2 , 2.0 , 2 ])
66
64
result = s .isconstant ()
67
- assert result
65
+ assert result
You can’t perform that action at this time.
0 commit comments