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

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/unit/core/test_bf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_get_standardized_ids_columns():
"0",
utils.UNNAMED_COLUMN_ID,
"duplicate",
"duplicate.1",
"duplicate_1",
"with_space",
]
assert idx_ids == []
Expand All @@ -37,13 +37,13 @@ def test_get_standardized_ids_indexes():

col_ids, idx_ids = utils.get_standardized_ids(col_labels, idx_labels)

assert col_ids == ["duplicate.2"]
assert col_ids == ["duplicate_2"]
assert idx_ids == [
"string",
"0",
utils.UNNAMED_INDEX_ID,
"duplicate",
"duplicate.1",
"duplicate_1",
"with_space",
]

Expand Down
10 changes: 5 additions & 5 deletions third_party/bigframes_vendored/pandas/io/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ def dedup_names(
"""
Rename column names if duplicates exist.

Currently the renaming is done by appending a period and an autonumeric,
but a custom pattern may be supported in the future.
Currently the renaming is done by appending a underscore and an
autonumeric, but a custom pattern may be supported in the future.

Examples
```
dedup_names(["x", "y", "x", "x"], is_potential_multiindex=False)
['x', 'y', 'x.1', 'x.2']
['x', 'y', 'x_1', 'x_2']
```
"""
names = list(names) # so we can index
Expand All @@ -34,9 +34,9 @@ def dedup_names(
if is_potential_multiindex:
# for mypy
assert isinstance(col, tuple)
col = col[:-1] + (f"{col[-1]}.{cur_count}",)
col = col[:-1] + (f"{col[-1]}_{cur_count}",)
else:
col = f"{col}.{cur_count}"
col = f"{col}_{cur_count}"
cur_count = counts[col]

names[i] = col
Expand Down