Skip to content

Commit 0f19cc9

Browse files
fix: dedup special character (#209)
* fix: dedup special character * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent a4a2e50 commit 0f19cc9

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tests/unit/core/test_bf_utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_get_standardized_ids_columns():
2525
"0",
2626
utils.UNNAMED_COLUMN_ID,
2727
"duplicate",
28-
"duplicate.1",
28+
"duplicate_1",
2929
"with_space",
3030
]
3131
assert idx_ids == []
@@ -37,13 +37,13 @@ def test_get_standardized_ids_indexes():
3737

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

40-
assert col_ids == ["duplicate.2"]
40+
assert col_ids == ["duplicate_2"]
4141
assert idx_ids == [
4242
"string",
4343
"0",
4444
utils.UNNAMED_INDEX_ID,
4545
"duplicate",
46-
"duplicate.1",
46+
"duplicate_1",
4747
"with_space",
4848
]
4949

third_party/bigframes_vendored/pandas/io/common.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ def dedup_names(
1313
"""
1414
Rename column names if duplicates exist.
1515
16-
Currently the renaming is done by appending a period and an autonumeric,
17-
but a custom pattern may be supported in the future.
16+
Currently the renaming is done by appending a underscore and an
17+
autonumeric, but a custom pattern may be supported in the future.
1818
1919
Examples
2020
```
2121
dedup_names(["x", "y", "x", "x"], is_potential_multiindex=False)
22-
['x', 'y', 'x.1', 'x.2']
22+
['x', 'y', 'x_1', 'x_2']
2323
```
2424
"""
2525
names = list(names) # so we can index
@@ -34,9 +34,9 @@ def dedup_names(
3434
if is_potential_multiindex:
3535
# for mypy
3636
assert isinstance(col, tuple)
37-
col = col[:-1] + (f"{col[-1]}.{cur_count}",)
37+
col = col[:-1] + (f"{col[-1]}_{cur_count}",)
3838
else:
39-
col = f"{col}.{cur_count}"
39+
col = f"{col}_{cur_count}"
4040
cur_count = counts[col]
4141

4242
names[i] = col

0 commit comments

Comments
 (0)