bigframes.extensions.core.series_accessor.BigQuerySeriesAccessor#
- class bigframes.extensions.core.series_accessor.BigQuerySeriesAccessor(obj: S)[source]#
Series accessor for BigQuery functions.
- abstract property aead: AeadSeriesAccessor[S]#
Accessor for BigQuery aead functions.
- array_concat(array_expression_2: Series | Expression | Any | Literal[Sentinel.ARGUMENT_DEFAULT], *, session: Session | None = None) S[source]#
Concatenates one or more arrays with the same element type into a single array.
- array_first(*, session: Session | None = None) S[source]#
Takes an array and returns the first element in the array.
- array_first_n(n: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | int, *, session: Session | None = None) S[source]#
Returns a prefix of input_array consisting of the first n elements.
- array_includes(search_value: Series | Expression | Any | Literal[Sentinel.ARGUMENT_DEFAULT], *, session: Session | None = None) S[source]#
Takes an array and returns TRUE if there is an element in the array that is equal to the search_value.
- array_includes_all(search_values: Series | Expression | Any | Literal[Sentinel.ARGUMENT_DEFAULT], *, session: Session | None = None) S[source]#
Takes an array to search and an array of search values. Returns TRUE if all search values are in the array to search, otherwise returns FALSE.
- array_includes_any(search_values: Series | Expression | Any | Literal[Sentinel.ARGUMENT_DEFAULT], *, session: Session | None = None) S[source]#
Takes an array to search and an array of search values. Returns TRUE if any search values are in the array to search, otherwise returns FALSE.
- array_is_distinct(*, session: Session | None = None) S[source]#
Returns TRUE if the array contains no repeated elements, using the same equality comparison logic as SELECT DISTINCT.
- array_last(*, session: Session | None = None) S[source]#
Takes an array and returns the last element in the array.
- array_length(*, session: Session | None = None) S[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:
- array_reverse(*, session: Session | None = None) S[source]#
Returns the input ARRAY with elements in reverse order.
- array_slice(start_offset: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | int, end_offset: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | int, *, session: Session | None = None) S[source]#
Returns an array containing zero or more consecutive elements from the input array.
- array_to_string(delimiter: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | bytes | str, null_text: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | bytes | str = Sentinel.ARGUMENT_DEFAULT, *, session: Session | None = None) S[source]#
Converts array elements within a Series into delimited strings.
Examples:
>>> import bigframes.pandas as bpd >>> import bigframes.bigquery as bbq
>>> s = bpd.Series([["H", "i", "!"], ["Hello", "World"], np.nan, [], ["Hi"]]) >>> bbq.array_to_string(s, delimiter=", ") 0 H, i, ! 1 Hello, World 2 3 4 Hi dtype: string
You can call this function using the Series bigquery accessor.
>>> s.bigquery.array_to_string(delimiter=", ") 0 H, i, ! 1 Hello, World 2 3 4 Hi dtype: string
You can also use this accessor on a pandas Series after importing bigframes.
>>> import bigframes >>> import pandas as pd >>> ps = pd.Series([["H", "i", "!"], ["Hello", "World"], None, [], ["Hi"]]) >>> ps.bigquery.array_to_string(delimiter=", ") 0 H, i, ! 1 Hello, World 2 3 4 Hi dtype: string
- Parameters:
series (bigframes.series.Series) – A Series containing arrays.
delimiter (str) – The string used to separate array elements.
null_text (str, optional) – The string to replace any NULL values in the array with.
- Returns:
A Series containing delimited strings.
- Return type:
- deterministic_decrypt_bytes(ciphertext: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | bytes, additional_data: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | bytes, *, session: Session | None = None) S[source]#
Uses the matching key from keyset to decrypt ciphertext and verifies the integrity of the data using additional_data. Returns an error if decryption fails.
- deterministic_decrypt_string(ciphertext: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | bytes, additional_data: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | str, *, session: Session | None = None) S[source]#
Like DETERMINISTIC_DECRYPT_BYTES, but where plaintext is of type STRING.
- deterministic_encrypt(plaintext: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | bytes | str, additional_data: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | bytes | str, *, session: Session | None = None) S[source]#
Encrypts plaintext using the primary cryptographic key in keyset using deterministic AEAD. The algorithm of the primary key must be DETERMINISTIC_AEAD_AES_SIV_CMAC_256. Binds the ciphertext to the context defined by additional_data. Returns NULL if any input is NULL.
- flatten(depth: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | int = Sentinel.ARGUMENT_DEFAULT, *, session: Session | None = None) S[source]#
Takes an array of nested data and flattens a specific part of it into a single, flat array with the [array elements field access operator][array-el-field-operator]. Returns NULL if the input value is NULL.