Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

when subsetting with and without .loc[ ] in python?

I was doing a Python exercises and I got the wrong answer (in red). I’m a bit confused about subsetting with and without loc[ ]. Please enlighten me. Thank you.
Datacamp exercise

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The df.loc[:, ['alignment', 'character']] itself is a dataframe. What you’re doing wrong is passing it inside df.

I suggest you to look around at the related pandas documentation.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading