https://flyte.org logo
#ask-the-community
Title
# ask-the-community
s

seunggs

06/18/2023, 10:27 PM
Hi, one of my tasks is failing with this error:
Copy code
"['\\ufeffID'] not found in axis"
The original code is:
Copy code
df.drop([r"\ufeffID"], axis=1, inplace=True)
So it looks like another escape character is added during execution?
s

Super Bo

06/19/2023, 2:05 AM
try
Copy code
df.drop("\ufeffID", axis=1, inplace=True)
r”" is used to denote rawstring, which will recognize “\u” as two separate character.
s

seunggs

06/19/2023, 2:06 AM
Sorry that’s what I tried the first time actually:
df.drop(["\ufeffID"], axis=1, inplace=True)
- it changes it errors out with an extra escape char:
"['\\ufeffID'] not found in axis"
s

Super Bo

06/19/2023, 2:11 AM
can you try remove the list notation
["\ufeffID"]
just use
"\ufeffID"
instead
s

seunggs

06/19/2023, 2:12 AM
OK will try that thanks
s

Super Bo

06/19/2023, 2:17 AM
another approach is selecting only valid column instead of dropping ( I suspect pandas may have problem with UTF-8 column).
Copy code
cols = df.columns.drop("\ufeffID")
df = df[cols]
72 Views