@@ -892,6 +892,30 @@ def dropna(self) -> DataFrame:
892892
893893 return DataFrame (block )
894894
895+ def any (
896+ self ,
897+ * ,
898+ bool_only : bool = False ,
899+ ) -> bigframes .series .Series :
900+ if not bool_only :
901+ frame = self ._raise_on_non_boolean ("any" )
902+ else :
903+ frame = self ._drop_non_bool ()
904+ block = frame ._block .aggregate_all_and_pivot (
905+ agg_ops .any_op , dtype = pd .BooleanDtype ()
906+ )
907+ return bigframes .series .Series (block .select_column ("values" ))
908+
909+ def all (self , * , bool_only : bool = False ) -> bigframes .series .Series :
910+ if not bool_only :
911+ frame = self ._raise_on_non_boolean ("all" )
912+ else :
913+ frame = self ._drop_non_bool ()
914+ block = frame ._block .aggregate_all_and_pivot (
915+ agg_ops .all_op , dtype = pd .BooleanDtype ()
916+ )
917+ return bigframes .series .Series (block .select_column ("values" ))
918+
895919 def sum (self , * , numeric_only : bool = False ) -> bigframes .series .Series :
896920 if not numeric_only :
897921 frame = self ._raise_on_non_numeric ("sum" )
@@ -940,6 +964,16 @@ def max(self, *, numeric_only: bool = False) -> bigframes.series.Series:
940964 block = frame ._block .aggregate_all_and_pivot (agg_ops .max_op )
941965 return bigframes .series .Series (block .select_column ("values" ))
942966
967+ def prod (self , * , numeric_only : bool = False ) -> bigframes .series .Series :
968+ if not numeric_only :
969+ frame = self ._raise_on_non_numeric ("prod" )
970+ else :
971+ frame = self ._drop_non_numeric ()
972+ block = frame ._block .aggregate_all_and_pivot (agg_ops .product_op )
973+ return bigframes .series .Series (block .select_column ("values" ))
974+
975+ product = prod
976+
943977 def count (self , * , numeric_only : bool = False ) -> bigframes .series .Series :
944978 if not numeric_only :
945979 frame = self
@@ -960,6 +994,14 @@ def _drop_non_numeric(self) -> DataFrame:
960994 ]
961995 return DataFrame (self ._block .drop_columns (non_numeric_cols ))
962996
997+ def _drop_non_bool (self ) -> DataFrame :
998+ non_bool_cols = [
999+ col_id
1000+ for col_id , dtype in zip (self ._block .value_columns , self ._block .dtypes )
1001+ if dtype not in bigframes .dtypes .BOOL_BIGFRAMES_TYPES
1002+ ]
1003+ return DataFrame (self ._block .drop_columns (non_bool_cols ))
1004+
9631005 def _raise_on_non_numeric (self , op : str ):
9641006 if not all (
9651007 dtype in bigframes .dtypes .NUMERIC_BIGFRAMES_TYPES
@@ -970,6 +1012,16 @@ def _raise_on_non_numeric(self, op: str):
9701012 )
9711013 return self
9721014
1015+ def _raise_on_non_boolean (self , op : str ):
1016+ if not all (
1017+ dtype in bigframes .dtypes .BOOL_BIGFRAMES_TYPES
1018+ for dtype in self ._block .dtypes
1019+ ):
1020+ raise NotImplementedError (
1021+ f"'{ op } ' does not support non-bool columns. Set 'bool_only'=True to ignore non-bool columns"
1022+ )
1023+ return self
1024+
9731025 def merge (
9741026 self ,
9751027 right : DataFrame ,
0 commit comments