Skip to content
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

Alternative solution for puzzle #8 #9

Closed
wants to merge 1 commit into from
Closed

Conversation

guiem
Copy link
Contributor

@guiem guiem commented Jan 16, 2018

No description provided.

@ajcr
Copy link
Owner

ajcr commented Jan 16, 2018

Thanks for this, a solution using iloc would be good here. However, I think it would be better to write

df.iloc[[3, 4, 8], df.columns.get_indexer_for(['animal', 'age'])]

instead as chaining indexing operations is generally discouraged in pandas when a single operation is possible (especially as chaining can lead to issues when setting items).

Are you happy to update this PR with this code?

@guiem
Copy link
Contributor Author

guiem commented Jan 16, 2018

Yeah, sure! 👍
Thanks a lot for the advice, and also thank you for creating these puzzles. I'm following them and the come very handy in order to learn/review the basics :)

@ajcr
Copy link
Owner

ajcr commented Jan 16, 2018

Awesome! Glad they're helpful.

@guiem guiem closed this Jan 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants