You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the plotly use case is slightly different. I currently wrote the following helper function:
def_generate_temporary_column_name(n_bytes: int, columns: list[str]) ->str:
"""Wraps of Narwhals generate_temporary_column_name to generate a token which is guaranteed to not be in columns, nor in [col + token for col in columns] """counter=0whileTrue:
# This is guaranteed to not be in columns by Narwhalstoken=nw.generate_temporary_column_name(n_bytes, columns=columns)
iftokennotin {f"{c}{token}"forcincolumns}:
returntokencounter+=1ifcounter>100:
msg= (
"Internal Error: Narwhals was not able to generate a column name with "f"{n_bytes=} and not in {columns}"
)
raiseAssertionError(msg)
This should generate a unique token which is not present in any of
[f'{prefix}{col}' for col in df.columns]
The text was updated successfully, but these errors were encountered: