0

I have a CSV file where one of the columns is titled "Type". Under this column I'm trying to replace values "Ford" and "GMC" as "Automotive". I believe with what I have, there's definitely an issue with formatting. Please advise.

df_jobs["Type"].replace(to_replace = "Ford", "GMC", value = "Automotive", inplace=True)

The error I'm getting is

"SyntaxError: positional argument follows keyword argument"

1 Answer 1

2

Error is self explanatory. "GMC" is a positional argument which is followed by to_replace = "Ford" which is a keyword argument.
What you need is make a list of "Ford" and "GMC" and then pass it to to_replace key:

df_jobs["Type"].replace(to_replace = ["Ford", "GMC"], value = "Automotive", inplace=True)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.