[ Web Proxy ]
URL:
Viewing: https://dataframes.bigquery.dev/reference/api/bigframes.bigquery.array_length.html [Back]  [Original]

bigframes.bigquery.array_length — bigframes documentation
Back to top
Search the docs ...:

bigframes.bigquery.array_length#

bigframes.bigquery.array_length(series: Series | Expression | Any | Literal[Sentinel.ARGUMENT_DEFAULT]) Series | Expression[source]#

Compute the length of each array element in the Series.

Examples:

>>> import bigframes.pandas as bpd
>>> import bigframes.bigquery as bbq
>>> s = bpd.Series([[1, 2, 8, 3], [], [3, 4]])
>>> bbq.array_length(s)
0    4
1    0
2    2
dtype: Int64

You can call this function using the Series bigquery accessor.

>>> s.bigquery.array_length()
0    4
1    0
2    2
dtype: Int64

You can also use this accessor on a pandas Series after importing bigframes.

>>> import bigframes
>>> import pandas as pd
>>> ps = pd.Series([[1, 2, 8, 3], [], [3, 4]])
>>> ps.bigquery.array_length()
0    4
1    0
2    2
dtype: Int64

You can also apply this function directly to Series using apply.

>>> s.apply(bbq.array_length, by_row=False)
0    4
1    0
2    2
dtype: Int64
Parameters:

series (bigframes.series.Series) A Series with array columns.

Returns:

A Series of integer values indicating

the length of each element in the Series.

Return type:

bigframes.series.Series


Web Proxy Viewer  |  New URL  |  Original Page