-
-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding caveats for DataFrame.iloc under Pandas Dataframes #598
Comments
I think a 'caveats' section would be a great addition, @candemircan. The lesson workflow does a good job of introducing learners to using different approaches to slice data frames. However, I wonder if learners may run into trouble when applying some of the knowledge from this lesson (e.g., adding columns to data later and running into index-based selection problems, as you mention). Perhaps immediately after the section "Result of slicing can be used in further operations", a section could be added to demonstrate the caveats and how learners might run into trouble. After completing the lesson, if learners start adding on further operations to .iloc, they might run into a "SettingWithCopyWarning", and be unsure why it is happening. Maybe addressing this specific warning is beyond the scope of the lesson, but including a brief section demonstrating the caveats would be valuable. |
Hi there, I agree and I would be happy to write something up in that direction. However, I would discuss this further before starting an attempt: Anyways, both methods have their caveats. A list from the top of my head would be (inlcuding yours):
There are probably even more subtle things to be aware of. My questions:
Best, |
Hi, |
Hi Kristina, I've updated the original issue's link that should be pointing here: https://swcarpentry.github.io/python-novice-gapminder/08-data-frames.html |
Hi!
For the Pandas Dataframes episode, under the
DataFrame.iloc[..., ...]
section, it might be worth mentioning the caveats of this method, i.e. if you add new columns to your data later, an index based selection (as opposed to using column names) can lead to problems. If this is worth adding, I would be happy to make the edit and make a pull request.Thanks,
Can
The text was updated successfully, but these errors were encountered: