Skip to content

Commit 471b7c7

Browse files
committed
Merge pull request #11828 from proinsias/use_is_or_is_not
CLN: Use `is` operator for comparing with `None` (Pep8)
2 parents 3733fa9 + e2726db commit 471b7c7

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

pandas/core/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4499,7 +4499,7 @@ def describe_1d(data, percentiles):
44994499
else:
45004500
data = self
45014501
elif include == 'all':
4502-
if exclude != None:
4502+
if exclude is not None:
45034503
msg = "exclude must be None when include is 'all'"
45044504
raise ValueError(msg)
45054505
data = self

pandas/core/groupby.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ def wrapper(*args, **kwargs):
586586
# a little trickery for aggregation functions that need an axis
587587
# argument
588588
kwargs_with_axis = kwargs.copy()
589-
if 'axis' not in kwargs_with_axis or kwargs_with_axis['axis']==None:
589+
if 'axis' not in kwargs_with_axis or kwargs_with_axis['axis'] is None:
590590
kwargs_with_axis['axis'] = self.axis
591591

592592
def curried_with_axis(x):

pandas/tests/test_base.py

+2
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,12 @@ def test_none_comparison(self):
293293

294294
o[0] = np.nan
295295

296+
# noinspection PyComparisonWithNone
296297
result = o == None
297298
self.assertFalse(result.iat[0])
298299
self.assertFalse(result.iat[1])
299300

301+
# noinspection PyComparisonWithNone
300302
result = o != None
301303
self.assertTrue(result.iat[0])
302304
self.assertTrue(result.iat[1])

pandas/util/decorators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def make_signature(func) :
274274
"""
275275
from inspect import getargspec
276276
spec = getargspec(func)
277-
if spec.defaults == None :
277+
if spec.defaults is None :
278278
n_wo_defaults = len(spec.args)
279279
defaults = ('',) * n_wo_defaults
280280
else :

0 commit comments

Comments
 (0)