Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions tests/system/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,6 @@ def nested_pandas_df() -> pd.DataFrame:
DATA_DIR / "nested.jsonl",
lines=True,
)
tests.system.utils.convert_pandas_dtypes(df, bytes_col=True)

df = df.set_index("rowindex")
return df

Expand Down
20 changes: 20 additions & 0 deletions tests/system/small/operations/test_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,26 @@ def test_len(scalars_dfs):
)


def test_len_with_array_column(nested_df, nested_pandas_df):
"""
Series.str.len() is expected to work on columns containing lists as well as strings.

See: https://stackoverflow.com/a/41340543/101923
"""
col_name = "event_sequence"
bf_series: bigframes.series.Series = nested_df[col_name]
bf_result = bf_series.str.len().to_pandas()
pd_result = nested_pandas_df[col_name].str.len()

# One of dtype mismatches to be documented. Here, the `bf_result.dtype` is `Int64` but
# the `pd_result.dtype` is `float64`: https://github.com/pandas-dev/pandas/issues/51948
assert_series_equal(
pd_result.astype(pd.Int64Dtype()),
bf_result,
check_index_type=False,
)


def test_lower(scalars_dfs):
scalars_df, scalars_pandas_df = scalars_dfs
col_name = "string_col"
Expand Down