Skip to content
Advertisement

Python/Pandas searching data in Dataframe

I want to explain my question with an example. I have a dataset which includes avocado average prices and many features about these prices(I guess avocado prices dataset is very popular, idk). And there is a feature called “region” that shows where avocadoes grew. I wrote this line of code to get to avocados feature which grews on “west”. my data’s name is data btw

JavaScript

And i thinked that what if i wanted to get the avocadoes which grew in 2016 and also grew on West. How can i get these data at the same time ?

Advertisement

Answer

I think the pandas DataFrame filter with boolean conditions can solve your question.

Suppose your column name for avocado growing year is grew_in. Then try this:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement