This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hello everyone,
I'm a bit stuck on a homework assignment. The goal of the assignment is to merge multiple CSV files into one data frame, then clean the data frame. I've merged the CSV files together and verified the number of rows that should be in the frame. I'm now stuck trying to replace two different typed-in error strings within the data frame.
I hope this explains it a bit more: I have two columns, income and rate. The income column has scattered errors reading "Syntax error in formula" followed by some other text. The rate column has "error: Please use field" followed by some other text. I assume the goal of this exercise, for the sake of the assignment, would be to replace the error strings with average values from the rest of the data frame, some 6,000 entries.
I've tried using some df.replace() commands, but without any luck. Is there a way to replace non-numerical entries within the two columns (income and rate) without affecting the rest of the data frame?
Thanks in advance for your help/input!
- Dalebert
Subreddit
Post Details
- Posted
- 3 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/learnpython...