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

Data Frame with unique pandas

I have a dataFrame(just a column) which has vehicle brands and its models like, Toyota Rav4, Kia Soul, (brand and models at the same column), I want to show all of Volvo’s models.
Output should be like that,

Volvo xc90
Volvo xc60
Volvo V90
.
.
.

What is the best coding?

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

>Solution :

Use str.contains('Volvo').
Demonstration:

df = pd.DataFrame(['Volvo xc90', 'Volvo xc60', 'Volvo V90', 'abc'])
df[df[0].str.contains('Volvo')]

enter image description here

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