I have a huge csv file with some columns. I want to extract the records based on particular column values
Till now i have read the csv file in pandas and now i want to extract data from the sheet based on particular column values. Below is the code and sample csv data.
import pandas as pd
import csv
data=pd.read_csv("raw_data_for_dryad.csv",usecols=["CaptureEventID","Species"])
print(data)
x=data.query('Species =="leopard" or Species=="cheetah" or Species=="buffalo" or Species=="human"',inplace=True)
print(x)
I tried the above code but it gives answer as NONE. This is my csv example
CaptureEventID  Species
ASG0000001  human
ASG0000001  human
ASG0000001  human
ASG0000001  human
ASG0000001  human
ASG0000001  human
ASG0000001  human
ASG0000001  blank
ASG0000001  human
ASG0000001  human
ASG0000001  human
ASG0000001  human
ASG0000001  human
ASG0000001  human
ASG0000001  human
ASG0000001  human
ASG0000001  blank
ASG0000001  human
ASG0000002  gazelleThomsons
ASG0000002  gazelleThomsons
ASG0000002  gazelleThomsons
I want to extract only the rows in which the value of Species column is either HUMAN or gazelleThomsons only. How can this be done?
