@@ -816,75 +816,88 @@ def bfill(self, *, limit: Optional[int] = None):
816816 raise NotImplementedError (constants .ABSTRACT_METHOD_ERROR_MESSAGE )
817817
818818 def isna (self ) -> NDFrame :
819- """Detect missing values.
819+ """Detect missing (NULL) values.
820820
821- Return a boolean same-sized object indicating if the values are NA.
822- NA values get mapped to True values. Everything else gets mapped to
823- False values. Characters such as empty strings ``''`` or
824- :attr:`numpy.inf` are not considered NA values.
821+ Return a boolean same-sized object indicating if the values are NA
822+ (NULL in BigQuery). NA/NULL values get mapped to True values.
823+ Everything else gets mapped to False values.
825824
826- **Examples:**
825+ Note that empty strings ``''``, :attr:`numpy.inf`, and
826+ :attr:`numpy.nan` are ***not*** considered NA values. This NA/NULL
827+ logic differs from numpy, but it is the same as BigQuery and the
828+ :class:`pandas.ArrowDtype`.
827829
828- >>> import bigframes.pandas as bpd
829- >>> bpd.options.display.progress_bar = None
830- >>> import numpy as np
830+ **Examples:**
831831
832832 >>> df = bpd.DataFrame(dict(
833- ... age=[5, 6, np.nan],
834- ... born=[bpd.NA, "1940-04-25", "1940-04-25"],
835- ... name=['Alfred', 'Batman', ''],
836- ... toy=[None, 'Batmobile', 'Joker'],
833+ ... age=pd.Series(pa.array(
834+ ... [5, 6, None, 4],
835+ ... type=pa.int64(),
836+ ... ), dtype=pd.ArrowDtype(pa.int64())),
837+ ... born=pd.to_datetime([pd.NA, "1940-04-25", "1940-04-25", "1941-08-25"]),
838+ ... name=['Alfred', 'Batman', '', 'Plastic Man'],
839+ ... toy=[None, 'Batmobile', 'Joker', 'Play dough'],
840+ ... height=pd.Series(pa.array(
841+ ... [6.1, 5.9, None, np.nan],
842+ ... type=pa.float64(),
843+ ... ), dtype=pd.ArrowDtype(pa.float64())),
837844 ... ))
838845 >>> df
839- age born name toy
840- 0 5.0 <NA> Alfred <NA>
841- 1 6.0 1940-04-25 Batman Batmobile
842- 2 <NA> 1940-04-25 Joker
846+ age born name toy height
847+ 0 5 <NA> Alfred <NA> 6.1
848+ 1 6 1940-04-25 00:00:00 Batman Batmobile 5.9
849+ 2 <NA> 1940-04-25 00:00:00 Joker <NA>
850+ 3 4 1941-08-25 00:00:00 Plastic Man Play dough NaN
843851 <BLANKLINE>
844- [3 rows x 4 columns]
852+ [4 rows x 5 columns]
845853
846- Show which entries in a DataFrame are NA:
854+ Show which entries in a DataFrame are NA (NULL in BigQuery) :
847855
848856 >>> df.isna()
849- age born name toy
850- 0 False True False True
851- 1 False False False False
852- 2 True False False False
857+ age born name toy height
858+ 0 False True False True False
859+ 1 False False False False False
860+ 2 True False False False True
861+ 3 False False False False False
853862 <BLANKLINE>
854- [3 rows x 4 columns]
863+ [4 rows x 5 columns]
855864
856865 >>> df.isnull()
857- age born name toy
858- 0 False True False True
859- 1 False False False False
860- 2 True False False False
866+ age born name toy height
867+ 0 False True False True False
868+ 1 False False False False False
869+ 2 True False False False True
870+ 3 False False False False False
861871 <BLANKLINE>
862- [3 rows x 4 columns]
872+ [4 rows x 5 columns]
863873
864- Show which entries in a Series are NA:
874+ Show which entries in a Series are NA (NULL in BigQuery) :
865875
866- >>> ser = bpd.Series([5, None, 6, np.nan, bpd.NA])
876+ >>> ser = bpd.Series(pa.array(
877+ ... [5, None, 6, np.nan, None],
878+ ... type=pa.float64(),
879+ ... ), dtype=pd.ArrowDtype(pa.float64()))
867880 >>> ser
868- 0 5
881+ 0 5.0
869882 1 <NA>
870- 2 6
871- 3 <NA>
883+ 2 6.0
884+ 3 NaN
872885 4 <NA>
873- dtype: Int64
886+ dtype: Float64
874887
875888 >>> ser.isna()
876889 0 False
877890 1 True
878891 2 False
879- 3 True
892+ 3 False
880893 4 True
881894 dtype: boolean
882895
883896 >>> ser.isnull()
884897 0 False
885898 1 True
886899 2 False
887- 3 True
900+ 3 False
888901 4 True
889902 dtype: boolean
890903
0 commit comments