Skip to content

Commit 972d87e

Browse files
Precommit done
1 parent 096cfaa commit 972d87e

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

pandas/core/series.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import warnings
2626

2727
import numpy as np
28-
import numba
2928

3029
from pandas._libs import (
3130
lib,
@@ -5424,14 +5423,14 @@ def isnull(self) -> Series:
54245423
"""
54255424
return super().isnull()
54265425

5427-
def isconstant(self, dropna = False):
5426+
def isconstant(self, dropna=False):
54285427
"""
54295428
Return if the series has constant values.
54305429
54315430
Parameters
54325431
----------
54335432
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
54355434
in the determination of whether the series has constant values.
54365435
54375436
Returns
@@ -5462,7 +5461,7 @@ def isconstant(self, dropna = False):
54625461
v = remove_na_arraylike(v)
54635462
if v.shape[0] == 0 or not notna(v).any():
54645463
return True
5465-
return (v[0] == v).all()
5464+
return (v[0] == v).all()
54665465

54675466
# error: Cannot determine type of 'notna'
54685467
@doc(NDFrame.notna, klass=_shared_doc_kwargs["klass"]) # type: ignore[has-type]

pandas/tests/series/methods/test_isconstant.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import numpy as np
2-
import pytest
32

4-
from pandas import (
5-
Series,
6-
)
3+
from pandas import Series
4+
75

86
class TestSeriesIsConstant:
97
def test_isconstant(self):
@@ -28,11 +26,11 @@ def test_isconstant_with_nan(self):
2826
result = s.isconstant()
2927
assert result
3028

31-
s = Series([np.nan,np.nan])
29+
s = Series([np.nan, np.nan])
3230
result = s.isconstant()
3331
assert result
3432

35-
s = Series([np.nan,1])
33+
s = Series([np.nan, 1])
3634
result = s.isconstant()
3735
assert not result
3836

@@ -45,11 +43,11 @@ def test_isconstant_with_nan_dropna(self):
4543
result = s.isconstant(True)
4644
assert result
4745

48-
s = Series([np.nan,np.nan])
46+
s = Series([np.nan, np.nan])
4947
result = s.isconstant(True)
5048
assert result
5149

52-
s = Series([np.nan,1])
50+
s = Series([np.nan, 1])
5351
result = s.isconstant(True)
5452
assert result
5553

@@ -58,10 +56,10 @@ def test_isconstant_with_nan_dropna(self):
5856
assert result
5957

6058
def test_isconstant_mixed_types(self):
61-
s = Series([2, '2', 2])
59+
s = Series([2, "2", 2])
6260
result = s.isconstant()
6361
assert not result
6462

6563
s = Series([2, 2.0, 2])
6664
result = s.isconstant()
67-
assert result
65+
assert result

0 commit comments

Comments
 (0)