File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed
third_party/bigframes_vendored/pandas/core/indexes Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -533,6 +533,16 @@ def value_counts(
533533
534534 return series .Series (block )
535535
536+ def isna (self ) -> Index :
537+ return self ._apply_unary_op (ops .isnull_op )
538+
539+ isnull = isna
540+
541+ def notna (self ) -> Index :
542+ return self ._apply_unary_op (ops .notnull_op )
543+
544+ notnull = notna
545+
536546 def fillna (self , value = None ) -> Index :
537547 if self .nlevels > 1 :
538548 raise TypeError ("Multiindex does not support 'fillna'" )
Original file line number Diff line number Diff line change @@ -300,6 +300,20 @@ def test_index_fillna(scalars_df_index, scalars_pandas_df_index):
300300 pd .testing .assert_index_equal (bf_result , pd_result )
301301
302302
303+ def test_index_isna (scalars_df_index , scalars_pandas_df_index ):
304+ bf_result = scalars_df_index .set_index ("int64_col" ).index .isna ().to_pandas ()
305+ pd_result = scalars_pandas_df_index .set_index ("int64_col" ).index .isna ()
306+
307+ pd .testing .assert_index_equal (bf_result , pd .Index (pd_result ))
308+
309+
310+ def test_index_notna (scalars_df_index , scalars_pandas_df_index ):
311+ bf_result = scalars_df_index .set_index ("float64_col" ).index .notna ().to_pandas ()
312+ pd_result = scalars_pandas_df_index .set_index ("float64_col" ).index .notna ()
313+
314+ pd .testing .assert_index_equal (bf_result , pd .Index (pd_result ))
315+
316+
303317def test_index_drop (scalars_df_index , scalars_pandas_df_index ):
304318 bf_result = (
305319 scalars_df_index .set_index ("int64_col" ).index .drop ([2 , 314159 ]).to_pandas ()
Original file line number Diff line number Diff line change @@ -962,6 +962,38 @@ def fillna(self, value) -> Index:
962962 """
963963 raise NotImplementedError (constants .ABSTRACT_METHOD_ERROR_MESSAGE )
964964
965+ def isna (self ):
966+ """
967+ Detect missing values.
968+
969+ Return a boolean same-sized object indicating if the values are NA.
970+ NA values, such as ``None``, :attr:`numpy.NaN` or :attr:`pd.NaT`, get
971+ mapped to ``True`` values.
972+ Everything else get mapped to ``False`` values. Characters such as
973+ empty strings `''` or :attr:`numpy.inf` are not considered NA values.
974+
975+ Returns:
976+ Index:
977+ Boolean index to indicate which entries are NA.
978+ """
979+ raise NotImplementedError (constants .ABSTRACT_METHOD_ERROR_MESSAGE )
980+
981+ def notna (self ):
982+ """
983+ Detect existing (non-missing) values.
984+
985+ Return a boolean same-sized object indicating if the values are not NA.
986+ Non-missing values get mapped to ``True``. Characters such as empty
987+ strings ``''`` or :attr:`numpy.inf` are not considered NA values.
988+ NA values, such as None or :attr:`numpy.NaN`, get mapped to ``False``
989+ values.
990+
991+ Returns:
992+ Index:
993+ Boolean index to indicate which entries are not NA.
994+ """
995+ raise NotImplementedError (constants .ABSTRACT_METHOD_ERROR_MESSAGE )
996+
965997 def rename (self , name , * , inplace ):
966998 """
967999 Alter Index or MultiIndex name.
You can’t perform that action at this time.
0 commit comments