@@ -796,72 +796,88 @@ def bfill(self, *, limit: Optional[int] = None):
796796 raise NotImplementedError (constants .ABSTRACT_METHOD_ERROR_MESSAGE )
797797
798798 def isna (self ) -> NDFrame :
799- """Detect missing values.
799+ """Detect missing (NULL) values.
800800
801- Return a boolean same-sized object indicating if the values are NA.
802- NA values get mapped to True values. Everything else gets mapped to
803- False values. Characters such as empty strings ``''`` or
804- :attr:`numpy.inf` are not considered NA values.
801+ Return a boolean same-sized object indicating if the values are NA
802+ (NULL in BigQuery). NA/NULL values get mapped to True values.
803+ Everything else gets mapped to False values.
805804
806- **Examples:**
805+ Note that empty strings ``''``, :attr:`numpy.inf`, and
806+ :attr:`numpy.nan` are ***not*** considered NA values. This NA/NULL
807+ logic differs from numpy, but it is the same as BigQuery and the
808+ :class:`pandas.ArrowDtype`.
807809
810+ **Examples:**
808811
809812 >>> df = bpd.DataFrame(dict(
810- ... age=[5, 6, np.nan],
811- ... born=[pd.NA, "1940-04-25", "1940-04-25"],
812- ... name=['Alfred', 'Batman', ''],
813- ... toy=[None, 'Batmobile', 'Joker'],
813+ ... age=pd.Series(pa.array(
814+ ... [5, 6, None, 4],
815+ ... type=pa.int64(),
816+ ... ), dtype=pd.ArrowDtype(pa.int64())),
817+ ... born=pd.to_datetime([pd.NA, "1940-04-25", "1940-04-25", "1941-08-25"]),
818+ ... name=['Alfred', 'Batman', '', 'Plastic Man'],
819+ ... toy=[None, 'Batmobile', 'Joker', 'Play dough'],
820+ ... height=pd.Series(pa.array(
821+ ... [6.1, 5.9, None, np.nan],
822+ ... type=pa.float64(),
823+ ... ), dtype=pd.ArrowDtype(pa.float64())),
814824 ... ))
815825 >>> df
816- age born name toy
817- 0 5.0 <NA> Alfred <NA>
818- 1 6.0 1940-04-25 Batman Batmobile
819- 2 <NA> 1940-04-25 Joker
826+ age born name toy height
827+ 0 5 <NA> Alfred <NA> 6.1
828+ 1 6 1940-04-25 00:00:00 Batman Batmobile 5.9
829+ 2 <NA> 1940-04-25 00:00:00 Joker <NA>
830+ 3 4 1941-08-25 00:00:00 Plastic Man Play dough NaN
820831 <BLANKLINE>
821- [3 rows x 4 columns]
832+ [4 rows x 5 columns]
822833
823- Show which entries in a DataFrame are NA:
834+ Show which entries in a DataFrame are NA (NULL in BigQuery) :
824835
825836 >>> df.isna()
826- age born name toy
827- 0 False True False True
828- 1 False False False False
829- 2 True False False False
837+ age born name toy height
838+ 0 False True False True False
839+ 1 False False False False False
840+ 2 True False False False True
841+ 3 False False False False False
830842 <BLANKLINE>
831- [3 rows x 4 columns]
843+ [4 rows x 5 columns]
832844
833845 >>> df.isnull()
834- age born name toy
835- 0 False True False True
836- 1 False False False False
837- 2 True False False False
846+ age born name toy height
847+ 0 False True False True False
848+ 1 False False False False False
849+ 2 True False False False True
850+ 3 False False False False False
838851 <BLANKLINE>
839- [3 rows x 4 columns]
852+ [4 rows x 5 columns]
840853
841- Show which entries in a Series are NA:
854+ Show which entries in a Series are NA (NULL in BigQuery) :
842855
843- >>> ser = bpd.Series([5, None, 6, np.nan, pd.NA])
856+ >>> ser = bpd.Series(pa.array(
857+ ... [5, None, 6, np.nan, None],
858+ ... type=pa.float64(),
859+ ... ), dtype=pd.ArrowDtype(pa.float64()))
844860 >>> ser
845- 0 5
861+ 0 5.0
846862 1 <NA>
847- 2 6
848- 3 <NA>
863+ 2 6.0
864+ 3 NaN
849865 4 <NA>
850- dtype: Int64
866+ dtype: Float64
851867
852868 >>> ser.isna()
853869 0 False
854870 1 True
855871 2 False
856- 3 True
872+ 3 False
857873 4 True
858874 dtype: boolean
859875
860876 >>> ser.isnull()
861877 0 False
862878 1 True
863879 2 False
864- 3 True
880+ 3 False
865881 4 True
866882 dtype: boolean
867883
0 commit comments