Python Forum
How to extract the matching rows
Thread Rating:
  • 3 Vote(s) - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to extract the matching rows
#1
Hi,

I have below matrix

column1   column2       column3

Mak         2                  3
Lak          4                  5
Nahl        7                  18
Mak        5                  20
Haui       11                4
Mak       4                  6

I want extract if the colum1 element is eqaul to "Mak"

My output should be:

Mak         2                  3
Mak        5                  20
Mak       4                  6

Many thanks,
Reply
#2
When you post homework-looking questions like this, it's best to give it a try, show us what you've tried, and explain why you think it should work when it doesn't.

In this case, I'll give you a hint in advance - you probably want str.split.
Reply
#3
Show some code! Is your "matrix" a big string? List of lists? List of dicts? List of objects? numpy array?
How do you expect help if you don't give any information about what you need help with?
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020