Skip to content

Commit 7050bbd

Browse files
committed
COMPAT: rename isnull -> isna, notnull -> notna
existing isnull, notnull remain user facing closes #15001
1 parent 1d0e6a1 commit 7050bbd

File tree

134 files changed

+976
-903
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+976
-903
lines changed

doc/source/10min.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ To get the boolean mask where values are ``nan``
373373

374374
.. ipython:: python
375375
376-
pd.isnull(df1)
376+
pd.isna(df1)
377377
378378
379379
Operations

doc/source/api.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ Top-level missing data
187187
.. autosummary::
188188
:toctree: generated/
189189

190-
isnull
191-
notnull
190+
isna
191+
notna
192192

193193
Top-level conversions
194194
~~~~~~~~~~~~~~~~~~~~~
@@ -272,8 +272,8 @@ Conversion
272272
Series.astype
273273
Series.infer_objects
274274
Series.copy
275-
Series.isnull
276-
Series.notnull
275+
Series.isna
276+
Series.notna
277277

278278
Indexing, iteration
279279
~~~~~~~~~~~~~~~~~~~
@@ -780,8 +780,8 @@ Conversion
780780
DataFrame.convert_objects
781781
DataFrame.infer_objects
782782
DataFrame.copy
783-
DataFrame.isnull
784-
DataFrame.notnull
783+
DataFrame.isna
784+
DataFrame.notna
785785

786786
Indexing, iteration
787787
~~~~~~~~~~~~~~~~~~~
@@ -1098,8 +1098,8 @@ Conversion
10981098

10991099
Panel.astype
11001100
Panel.copy
1101-
Panel.isnull
1102-
Panel.notnull
1101+
Panel.isna
1102+
Panel.notna
11031103

11041104
Getting and setting
11051105
~~~~~~~~~~~~~~~~~~~
@@ -1342,8 +1342,8 @@ Missing Values
13421342

13431343
Index.fillna
13441344
Index.dropna
1345-
Index.isnull
1346-
Index.notnull
1345+
Index.isna
1346+
Index.notna
13471347

13481348
Conversion
13491349
~~~~~~~~~~

doc/source/basics.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ So, for instance, to reproduce :meth:`~DataFrame.combine_first` as above:
444444

445445
.. ipython:: python
446446
447-
combiner = lambda x, y: np.where(pd.isnull(x), y, x)
447+
combiner = lambda x, y: np.where(pd.isna(x), y, x)
448448
df1.combine(df2, combiner)
449449
450450
.. _basics.stats:
@@ -511,7 +511,7 @@ optional ``level`` parameter which applies only if the object has a
511511
:header: "Function", "Description"
512512
:widths: 20, 80
513513

514-
``count``, Number of non-null observations
514+
``count``, Number of non-na observations
515515
``sum``, Sum of values
516516
``mean``, Mean of values
517517
``mad``, Mean absolute deviation
@@ -541,7 +541,7 @@ will exclude NAs on Series input by default:
541541
np.mean(df['one'].values)
542542
543543
``Series`` also has a method :meth:`~Series.nunique` which will return the
544-
number of unique non-null values:
544+
number of unique non-na values:
545545

546546
.. ipython:: python
547547

doc/source/categorical.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,14 +863,14 @@ a code of ``-1``.
863863
s.cat.codes
864864
865865
866-
Methods for working with missing data, e.g. :meth:`~Series.isnull`, :meth:`~Series.fillna`,
866+
Methods for working with missing data, e.g. :meth:`~Series.isna`, :meth:`~Series.fillna`,
867867
:meth:`~Series.dropna`, all work normally:
868868

869869
.. ipython:: python
870870
871871
s = pd.Series(["a", "b", np.nan], dtype="category")
872872
s
873-
pd.isnull(s)
873+
pd.isna(s)
874874
s.fillna("a")
875875
876876
Differences to R's `factor`

doc/source/comparison_with_sas.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,13 +444,13 @@ For example, in SAS you could do this to filter missing values.
444444
if value_x ^= .;
445445
run;
446446
447-
Which doesn't work in in pandas. Instead, the ``pd.isnull`` or ``pd.notnull`` functions
447+
Which doesn't work in in pandas. Instead, the ``pd.isna`` or ``pd.notna`` functions
448448
should be used for comparisons.
449449

450450
.. ipython:: python
451451
452-
outer_join[pd.isnull(outer_join['value_x'])]
453-
outer_join[pd.notnull(outer_join['value_x'])]
452+
outer_join[pd.isna(outer_join['value_x'])]
453+
outer_join[pd.notna(outer_join['value_x'])]
454454
455455
pandas also provides a variety of methods to work with missing data - some of
456456
which would be challenging to express in SAS. For example, there are methods to
@@ -570,15 +570,15 @@ machine's memory, but also that the operations on that data may be faster.
570570

571571
If out of core processing is needed, one possibility is the
572572
`dask.dataframe <http://dask.pydata.org/en/latest/dataframe.html>`_
573-
library (currently in development) which
573+
library (currently in development) which
574574
provides a subset of pandas functionality for an on-disk ``DataFrame``
575575

576576
Data Interop
577577
~~~~~~~~~~~~
578578

579579
pandas provides a :func:`read_sas` method that can read SAS data saved in
580580
the XPORT or SAS7BDAT binary format.
581-
581+
582582
.. code-block:: none
583583
584584
libname xportout xport 'transport-file.xpt';
@@ -613,4 +613,3 @@ to interop data between SAS and pandas is to serialize to csv.
613613
614614
In [9]: %time df = pd.read_csv('big.csv')
615615
Wall time: 4.86 s
616-

doc/source/comparison_with_sql.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Just like SQL's OR and AND, multiple conditions can be passed to a DataFrame usi
101101
# tips by parties of at least 5 diners OR bill total was more than $45
102102
tips[(tips['size'] >= 5) | (tips['total_bill'] > 45)]
103103
104-
NULL checking is done using the :meth:`~pandas.Series.notnull` and :meth:`~pandas.Series.isnull`
104+
NULL checking is done using the :meth:`~pandas.Series.notna` and :meth:`~pandas.Series.isna`
105105
methods.
106106

107107
.. ipython:: python
@@ -121,9 +121,9 @@ where ``col2`` IS NULL with the following query:
121121
122122
.. ipython:: python
123123
124-
frame[frame['col2'].isnull()]
124+
frame[frame['col2'].isna()]
125125
126-
Getting items where ``col1`` IS NOT NULL can be done with :meth:`~pandas.Series.notnull`.
126+
Getting items where ``col1`` IS NOT NULL can be done with :meth:`~pandas.Series.notna`.
127127

128128
.. code-block:: sql
129129
@@ -133,7 +133,7 @@ Getting items where ``col1`` IS NOT NULL can be done with :meth:`~pandas.Series.
133133
134134
.. ipython:: python
135135
136-
frame[frame['col1'].notnull()]
136+
frame[frame['col1'].notna()]
137137
138138
139139
GROUP BY

doc/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@
238238
# https://github.com/pandas-dev/pandas/issues/16186
239239

240240
moved_api_pages = [
241-
('pandas.core.common.isnull', 'pandas.isnull'),
242-
('pandas.core.common.notnull', 'pandas.notnull'),
241+
('pandas.core.common.isnull', 'pandas.isna'),
242+
('pandas.core.common.notnull', 'pandas.notna'),
243243
('pandas.core.reshape.get_dummies', 'pandas.get_dummies'),
244244
('pandas.tools.merge.concat', 'pandas.concat'),
245245
('pandas.tools.merge.merge', 'pandas.merge'),

doc/source/gotchas.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ For many reasons we chose the latter. After years of production use it has
202202
proven, at least in my opinion, to be the best decision given the state of
203203
affairs in NumPy and Python in general. The special value ``NaN``
204204
(Not-A-Number) is used everywhere as the ``NA`` value, and there are API
205-
functions ``isnull`` and ``notnull`` which can be used across the dtypes to
205+
functions ``isna`` and ``notna`` which can be used across the dtypes to
206206
detect NA values.
207207

208208
However, it comes with it a couple of trade-offs which I most certainly have

doc/source/missing_data.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ When / why does data become missing?
3636
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3737

3838
Some might quibble over our usage of *missing*. By "missing" we simply mean
39-
**null** or "not present for whatever reason". Many data sets simply arrive with
39+
**na** or "not present for whatever reason". Many data sets simply arrive with
4040
missing data, either because it exists and was not collected or it never
4141
existed. For example, in a collection of financial time series, some of the time
4242
series might start on different dates. Thus, values prior to the start date
@@ -63,27 +63,27 @@ to handling missing data. While ``NaN`` is the default missing value marker for
6363
reasons of computational speed and convenience, we need to be able to easily
6464
detect this value with data of different types: floating point, integer,
6565
boolean, and general object. In many cases, however, the Python ``None`` will
66-
arise and we wish to also consider that "missing" or "null".
66+
arise and we wish to also consider that "missing" or "na".
6767

6868
.. note::
6969

7070
Prior to version v0.10.0 ``inf`` and ``-inf`` were also
71-
considered to be "null" in computations. This is no longer the case by
72-
default; use the ``mode.use_inf_as_null`` option to recover it.
71+
considered to be "na" in computations. This is no longer the case by
72+
default; use the ``mode.use_inf_as_na`` option to recover it.
7373

74-
.. _missing.isnull:
74+
.. _missing.isna:
7575

7676
To make detecting missing values easier (and across different array dtypes),
77-
pandas provides the :func:`~pandas.core.common.isnull` and
78-
:func:`~pandas.core.common.notnull` functions, which are also methods on
77+
pandas provides the :func:`isna` and
78+
:func:`notna` functions, which are also methods on
7979
``Series`` and ``DataFrame`` objects:
8080

8181
.. ipython:: python
8282
8383
df2['one']
84-
pd.isnull(df2['one'])
85-
df2['four'].notnull()
86-
df2.isnull()
84+
pd.isna(df2['one'])
85+
df2['four'].notna()
86+
df2.isna()
8787
8888
.. warning::
8989

@@ -206,7 +206,7 @@ with missing data.
206206
Filling missing values: fillna
207207
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
208208

209-
The **fillna** function can "fill in" NA values with non-null data in a couple
209+
The **fillna** function can "fill in" NA values with non-na data in a couple
210210
of ways, which we illustrate:
211211

212212
**Replace NA with a scalar value**
@@ -220,7 +220,7 @@ of ways, which we illustrate:
220220
**Fill gaps forward or backward**
221221

222222
Using the same filling arguments as :ref:`reindexing <basics.reindexing>`, we
223-
can propagate non-null values forward or backward:
223+
can propagate non-na values forward or backward:
224224

225225
.. ipython:: python
226226
@@ -288,7 +288,7 @@ a Series in this case.
288288

289289
.. ipython:: python
290290
291-
dff.where(pd.notnull(dff), dff.mean(), axis='columns')
291+
dff.where(pd.notna(dff), dff.mean(), axis='columns')
292292
293293
294294
.. _missing_data.dropna:

doc/source/options.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,10 @@ mode.chained_assignment warn Raise an exception, warn, or no
419419
assignment, The default is warn
420420
mode.sim_interactive False Whether to simulate interactive mode
421421
for purposes of testing.
422-
mode.use_inf_as_null False True means treat None, NaN, -INF,
423-
INF as null (old way), False means
422+
mode.use_inf_as_na False True means treat None, NaN, -INF,
423+
INF as NA (old way), False means
424424
None and NaN are null, but INF, -INF
425-
are not null (new way).
425+
are not NA (new way).
426426
compute.use_bottleneck True Use the bottleneck library to accelerate
427427
computation if it is installed.
428428
compute.use_numexpr True Use the numexpr library to accelerate

0 commit comments

Comments
 (0)