Repository navigation
[FAQ Bot] NEW: How do I avoid KeyError: 'converted' when re-running a cell that delet - #471
Open
github-actions[bot] wants to merge 1 commit into
Open
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
|
You can use a safer approach to delete the columns such as: With errors="ignore", pandas will remove the column if it exists and do nothing if it has already been removed. Another good notebook pattern is to avoid modifying the original split DataFrames directly. For instance: This keeps df_train unchanged, so re-running cells is less likely to cause problems. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✨ FAQ NEW
Course: machine-learning-zoomcamp
Section: misc (This is a notebook/Jupyter rerun troubleshooting issue tied to the dataset split and target handling; it fits best in the cross-cutting notebook troubleshooting section.)
Related Issue: #470
Question
How do I avoid
KeyError: 'converted'when re-running a cell that deletes the target column in pandas?Decision Rationale
The repository does not yet have an FAQ specifically about avoiding
KeyError: 'converted'when re-running a notebook cell after deleting the target column. The closest existing FAQ covers whether the target should remain in feature dataframes, not the rerun/delete idempotency issue.Placement Details
miscavoid-keyerror-converted-rerun-delete-target🤖 Generated by FAQ Bot
Closes #470