Skip to content

Commit e61ddcd

Browse files
committed
add docs
1 parent cabaae5 commit e61ddcd

File tree

8 files changed

+51
-56
lines changed

8 files changed

+51
-56
lines changed

bigframes/bigquery/__init__.py

+36-5
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,41 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import bigframes.bigquery.array as array
1615

17-
array_length = array.array_length
16+
"""This module integrates BigQuery built-in functions for use with DataFrame objects,
17+
such as array functions:
18+
https://cloud.google.com/bigquery/docs/reference/standard-sql/array_functions. """
1819

19-
__all___ = [
20-
"array_length",
21-
]
20+
21+
from __future__ import annotations
22+
23+
import typing
24+
25+
import bigframes.operations as ops
26+
27+
if typing.TYPE_CHECKING:
28+
import bigframes.series as series
29+
30+
31+
def array_length(series: series.Series) -> series.Series:
32+
"""Compute the length of each array element in the Series.
33+
34+
**Examples:**
35+
36+
>>> import bigframes.pandas as bpd
37+
>>> import bigframes.bigquery as bbq
38+
>>> bpd.options.display.progress_bar = None
39+
40+
>>> s = bpd.Series([[1, 2, 8, 3], [], [3, 4]])
41+
>>> bbq.array_length(s)
42+
0 4
43+
1 0
44+
2 2
45+
dtype: Int64
46+
47+
Returns:
48+
bigframes.series.Series: A Series of integer values indicating
49+
the length of each element in the Series.
50+
51+
"""
52+
return series._apply_unary_op(ops.len_op)

bigframes/bigquery/array.py

-49
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
===========================
3+
BigQuery Built-in Functions
4+
===========================
5+
6+
.. automodule:: bigframes.bigquery
7+
:members:
8+
:inherited-members:
9+
:undoc-members:

docs/reference/bigframes/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
============
23
Core objects
34
============
45

docs/reference/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ packages.
1010
bigframes/index
1111
bigframes.pandas/index
1212
bigframes.ml/index
13+
bigframes.bigquery/index

docs/templates/toc.yml

+2
Original file line numberDiff line numberDiff line change
@@ -189,5 +189,7 @@
189189
uid: bigframes.ml.remote.VertexAIModel
190190
name: remote
191191
name: bigframes.ml
192+
- name: Bigquery Built-in Functions
193+
uid: bigframes.bigquery
192194
name: BigQuery DataFrames
193195
status: beta

tests/system/small/bigquery/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023 Google LLC
1+
# Copyright 2024 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

tests/system/small/bigquery/test_array.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023 Google LLC
1+
# Copyright 2024 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)