Skip to content

Commit 5dabba3

Browse files
committed
Update sparse array minmax method 8
1 parent 227c282 commit 5dabba3

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

pandas/core/arrays/sparse/array.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,10 +1391,9 @@ def mean(self, axis=0, *args, **kwargs):
13911391
else:
13921392
nsparse = self.sp_index.ngaps
13931393
return (sp_sum + self.fill_value * nsparse) / (ct + nsparse)
1394-
1395-
1396-
def max(self, axis=0, *args, **kwargs):
13971394

1395+
1396+
def max(self, axis=0, *args, **kwargs):
13981397
nv.validate_max(args, kwargs)
13991398

14001399
if self.sp_index.ngaps > 0 and np.all(self._valid_sp_values < 0):
@@ -1404,7 +1403,6 @@ def max(self, axis=0, *args, **kwargs):
14041403

14051404

14061405
def min(self, axis=0, *args, **kwargs):
1407-
14081406
nv.validate_min(args, kwargs)
14091407

14101408
if self.sp_index.ngaps > 0 and np.all(self._valid_sp_values > 0):

pandas/tests/arrays/sparse/test_array.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,16 +1311,16 @@ def test_dropna(fill_value):
13111311
df = pd.DataFrame({"a": [0, 1], "b": arr})
13121312
expected_df = pd.DataFrame({"a": [1], "b": exp}, index=pd.Int64Index([1]))
13131313
tm.assert_equal(df.dropna(), expected_df)
1314-
1315-
1314+
1315+
13161316
def test_maxmin():
13171317
data = np.arange(10).astype(float)
13181318
max_out = SparseArray(data).max()
13191319
min_out = SparseArray(data).min()
13201320
assert max_out == 9
13211321
assert min_out == 0
13221322

1323-
data = data*(-1)
1323+
data = data * (-1)
13241324
max_out = SparseArray(data).max()
13251325
min_out = SparseArray(data).min()
13261326
assert max_out == 0

0 commit comments

Comments
 (0)