@@ -1462,41 +1462,48 @@ def dropna(
1462
1462
def any (
1463
1463
self ,
1464
1464
* ,
1465
+ axis : typing .Union [str , int ] = 0 ,
1465
1466
bool_only : bool = False ,
1466
1467
) -> bigframes .series .Series :
1467
1468
if not bool_only :
1468
1469
frame = self ._raise_on_non_boolean ("any" )
1469
1470
else :
1470
1471
frame = self ._drop_non_bool ()
1471
- block = frame ._block .aggregate_all_and_pivot (
1472
- agg_ops .any_op , dtype = pandas .BooleanDtype ()
1472
+ block = frame ._block .aggregate_all_and_stack (
1473
+ agg_ops .any_op , dtype = pandas .BooleanDtype (), axis = axis
1473
1474
)
1474
1475
return bigframes .series .Series (block .select_column ("values" ))
1475
1476
1476
- def all (self , * , bool_only : bool = False ) -> bigframes .series .Series :
1477
+ def all (
1478
+ self , axis : typing .Union [str , int ] = 0 , * , bool_only : bool = False
1479
+ ) -> bigframes .series .Series :
1477
1480
if not bool_only :
1478
1481
frame = self ._raise_on_non_boolean ("all" )
1479
1482
else :
1480
1483
frame = self ._drop_non_bool ()
1481
- block = frame ._block .aggregate_all_and_pivot (
1482
- agg_ops .all_op , dtype = pandas .BooleanDtype ()
1484
+ block = frame ._block .aggregate_all_and_stack (
1485
+ agg_ops .all_op , dtype = pandas .BooleanDtype (), axis = axis
1483
1486
)
1484
1487
return bigframes .series .Series (block .select_column ("values" ))
1485
1488
1486
- def sum (self , * , numeric_only : bool = False ) -> bigframes .series .Series :
1489
+ def sum (
1490
+ self , axis : typing .Union [str , int ] = 0 , * , numeric_only : bool = False
1491
+ ) -> bigframes .series .Series :
1487
1492
if not numeric_only :
1488
1493
frame = self ._raise_on_non_numeric ("sum" )
1489
1494
else :
1490
1495
frame = self ._drop_non_numeric ()
1491
- block = frame ._block .aggregate_all_and_pivot (agg_ops .sum_op )
1496
+ block = frame ._block .aggregate_all_and_stack (agg_ops .sum_op , axis = axis )
1492
1497
return bigframes .series .Series (block .select_column ("values" ))
1493
1498
1494
- def mean (self , * , numeric_only : bool = False ) -> bigframes .series .Series :
1499
+ def mean (
1500
+ self , axis : typing .Union [str , int ] = 0 , * , numeric_only : bool = False
1501
+ ) -> bigframes .series .Series :
1495
1502
if not numeric_only :
1496
1503
frame = self ._raise_on_non_numeric ("mean" )
1497
1504
else :
1498
1505
frame = self ._drop_non_numeric ()
1499
- block = frame ._block .aggregate_all_and_pivot (agg_ops .mean_op )
1506
+ block = frame ._block .aggregate_all_and_stack (agg_ops .mean_op , axis = axis )
1500
1507
return bigframes .series .Series (block .select_column ("values" ))
1501
1508
1502
1509
def median (
@@ -1510,47 +1517,57 @@ def median(
1510
1517
frame = self ._raise_on_non_numeric ("median" )
1511
1518
else :
1512
1519
frame = self ._drop_non_numeric ()
1513
- block = frame ._block .aggregate_all_and_pivot (agg_ops .median_op )
1520
+ block = frame ._block .aggregate_all_and_stack (agg_ops .median_op )
1514
1521
return bigframes .series .Series (block .select_column ("values" ))
1515
1522
1516
- def std (self , * , numeric_only : bool = False ) -> bigframes .series .Series :
1523
+ def std (
1524
+ self , axis : typing .Union [str , int ] = 0 , * , numeric_only : bool = False
1525
+ ) -> bigframes .series .Series :
1517
1526
if not numeric_only :
1518
1527
frame = self ._raise_on_non_numeric ("std" )
1519
1528
else :
1520
1529
frame = self ._drop_non_numeric ()
1521
- block = frame ._block .aggregate_all_and_pivot (agg_ops .std_op )
1530
+ block = frame ._block .aggregate_all_and_stack (agg_ops .std_op , axis = axis )
1522
1531
return bigframes .series .Series (block .select_column ("values" ))
1523
1532
1524
- def var (self , * , numeric_only : bool = False ) -> bigframes .series .Series :
1533
+ def var (
1534
+ self , axis : typing .Union [str , int ] = 0 , * , numeric_only : bool = False
1535
+ ) -> bigframes .series .Series :
1525
1536
if not numeric_only :
1526
1537
frame = self ._raise_on_non_numeric ("var" )
1527
1538
else :
1528
1539
frame = self ._drop_non_numeric ()
1529
- block = frame ._block .aggregate_all_and_pivot (agg_ops .var_op )
1540
+ block = frame ._block .aggregate_all_and_stack (agg_ops .var_op , axis = axis )
1530
1541
return bigframes .series .Series (block .select_column ("values" ))
1531
1542
1532
- def min (self , * , numeric_only : bool = False ) -> bigframes .series .Series :
1543
+ def min (
1544
+ self , axis : typing .Union [str , int ] = 0 , * , numeric_only : bool = False
1545
+ ) -> bigframes .series .Series :
1533
1546
if not numeric_only :
1534
1547
frame = self ._raise_on_non_numeric ("min" )
1535
1548
else :
1536
1549
frame = self ._drop_non_numeric ()
1537
- block = frame ._block .aggregate_all_and_pivot (agg_ops .min_op )
1550
+ block = frame ._block .aggregate_all_and_stack (agg_ops .min_op , axis = axis )
1538
1551
return bigframes .series .Series (block .select_column ("values" ))
1539
1552
1540
- def max (self , * , numeric_only : bool = False ) -> bigframes .series .Series :
1553
+ def max (
1554
+ self , axis : typing .Union [str , int ] = 0 , * , numeric_only : bool = False
1555
+ ) -> bigframes .series .Series :
1541
1556
if not numeric_only :
1542
1557
frame = self ._raise_on_non_numeric ("max" )
1543
1558
else :
1544
1559
frame = self ._drop_non_numeric ()
1545
- block = frame ._block .aggregate_all_and_pivot (agg_ops .max_op )
1560
+ block = frame ._block .aggregate_all_and_stack (agg_ops .max_op , axis = axis )
1546
1561
return bigframes .series .Series (block .select_column ("values" ))
1547
1562
1548
- def prod (self , * , numeric_only : bool = False ) -> bigframes .series .Series :
1563
+ def prod (
1564
+ self , axis : typing .Union [str , int ] = 0 , * , numeric_only : bool = False
1565
+ ) -> bigframes .series .Series :
1549
1566
if not numeric_only :
1550
1567
frame = self ._raise_on_non_numeric ("prod" )
1551
1568
else :
1552
1569
frame = self ._drop_non_numeric ()
1553
- block = frame ._block .aggregate_all_and_pivot (agg_ops .product_op )
1570
+ block = frame ._block .aggregate_all_and_stack (agg_ops .product_op , axis = axis )
1554
1571
return bigframes .series .Series (block .select_column ("values" ))
1555
1572
1556
1573
product = prod
@@ -1560,11 +1577,11 @@ def count(self, *, numeric_only: bool = False) -> bigframes.series.Series:
1560
1577
frame = self
1561
1578
else :
1562
1579
frame = self ._drop_non_numeric ()
1563
- block = frame ._block .aggregate_all_and_pivot (agg_ops .count_op )
1580
+ block = frame ._block .aggregate_all_and_stack (agg_ops .count_op )
1564
1581
return bigframes .series .Series (block .select_column ("values" ))
1565
1582
1566
1583
def nunique (self ) -> bigframes .series .Series :
1567
- block = self ._block .aggregate_all_and_pivot (agg_ops .nunique_op )
1584
+ block = self ._block .aggregate_all_and_stack (agg_ops .nunique_op )
1568
1585
return bigframes .series .Series (block .select_column ("values" ))
1569
1586
1570
1587
def agg (
@@ -1587,7 +1604,7 @@ def agg(
1587
1604
)
1588
1605
else :
1589
1606
return bigframes .series .Series (
1590
- self ._block .aggregate_all_and_pivot (
1607
+ self ._block .aggregate_all_and_stack (
1591
1608
agg_ops .lookup_agg_func (typing .cast (str , func ))
1592
1609
)
1593
1610
)
0 commit comments