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[T, S]#
Accessor for BigQuery aead functions.
- abstract property ai: AiSeriesAccessor[T, S]#
Accessor for BigQuery ai 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:
- bit_count(*, session: Session | None = None) S[source]#
The input, expression, must be an integer or BYTES. Returns the number of bits that are set in the input expression. For signed integers, this is the number of bits in two’s complement form.
- date(time_zone_expression: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | str = Sentinel.ARGUMENT_DEFAULT, year: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | int = Sentinel.ARGUMENT_DEFAULT, month: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | int = Sentinel.ARGUMENT_DEFAULT, day: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | int = Sentinel.ARGUMENT_DEFAULT, *, session: Session | None = None) S[source]#
Constructs or extracts a date.
- date_add(int64_expression: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | int, date_part: Series | Expression | Any | Literal[Sentinel.ARGUMENT_DEFAULT], *, session: Session | None = None) S[source]#
Adds a specified time interval to a DATE.
- date_diff(start_date: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | date, granularity: Series | Expression | Any | Literal[Sentinel.ARGUMENT_DEFAULT], *, session: Session | None = None) S[source]#
Gets the number of unit boundaries between two DATE values (end_date - start_date) at a particular time granularity.
- date_from_unix_date(*, session: Session | None = None) S[source]#
Interprets an INT64 expression as the number of days since 1970-01-01.
- date_sub(int64_expression: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | int, date_part: Series | Expression | Any | Literal[Sentinel.ARGUMENT_DEFAULT], *, session: Session | None = None) S[source]#
Subtracts a specified time interval from a DATE.
- date_trunc(granularity: Series | Expression | Any | Literal[Sentinel.ARGUMENT_DEFAULT], *, session: Session | None = None) S[source]#
Truncates a DATE, DATETIME, or TIMESTAMP value at a particular granularity.
- 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.
- double(wide_number_mode: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | str = Sentinel.ARGUMENT_DEFAULT, *, session: Session | None = None) S[source]#
Converts a JSON number to a SQL FLOAT64 value.
- extract(part: Series | Expression | Any | Literal[Sentinel.ARGUMENT_DEFAULT], time_zone: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | str = Sentinel.ARGUMENT_DEFAULT, *, session: Session | None = None) S[source]#
Returns the value corresponding to the specified date part.
- 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.
- float64(wide_number_mode: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | str = Sentinel.ARGUMENT_DEFAULT, *, session: Session | None = None) S[source]#
Converts a JSON number to a SQL FLOAT64 value.
- format_date(format_string: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | str, *, session: Session | None = None) S[source]#
Formats a DATE value according to a specified format string.
- last_day(date_part: Series | Expression | Any | Literal[Sentinel.ARGUMENT_DEFAULT] = Sentinel.ARGUMENT_DEFAULT, *, session: Session | None = None) S[source]#
Returns the last day from a date expression. This is commonly used to return the last day of the month.
- parse_bignumeric(*, session: Session | None = None) S[source]#
Converts a STRING to a BIGNUMERIC value.
- parse_date(format_string: Series | Expression | Literal[Sentinel.ARGUMENT_DEFAULT] | str, *, session: Session | None = None) S[source]#
Converts a STRING value to a DATE value.