Why do i get this error when I try to perform some logical operation on dataframes?

saicharan pogul

This is my DataFrame:
DataFrame

data.where(data["Gender"] == "Male") and data.where(data["Age"] == 19)

I'm trying to print matching values but i get this error. Explain the output.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
 in 
----> 1 data.where(data["Gender"] == "Male") and data.where(data["Age"] == 19)

~\Anaconda3\lib\site-packages\pandas\core\generic.py in __nonzero__(self)
   1553             "The truth value of a {0} is ambiguous. "
   1554             "Use a.empty, a.bool(), a.item(), a.any() or a.all().".format(
-> 1555                 self.__class__.__name__
   1556             )
   1557         )

ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Jakob F

You need to check both conditions at once:

data.where(data["Gender"] == "Male" and data["Age"] == 19)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Why do I get a compilation error when I try to have two methods with the same name and parameter type?

why do i get exception error when i try output array

Why do I get an error for "__CrtGetFileInformationByHandleEx " when I try to compile

Why do I get an "invalid values" error when I try to access the network settings on Eclipse Mars?

Why I get error when I try to create stored procedure?

Why do I see `503 Backend Error` when I try to get a Cloud Storage service account?

Why do I get an error when I try to add a dependent task to one created by the C plugin?

Why do i always get NULL in php response when i try to send some variable using ajax

Why Do I get an error when I try to get tkinter slider value?

Why do I get error INVALID_OPERATION when I call glMultiDrawElementsIndirect

Why do I get this error in my logcat when I try to post JSON data?

Why do I get error when I try to alert the length of the passed array to the function?

Why do I get an error (Notice: Undefined index) when I try to echo a value from my database?

Why do I get a syntax error when I try to print a nested hash that has keys containing colons?

Why do I get 'undefined' error when I try to read session atrribute from Controller

Why do I get an error message of NoneType object is not callable when I try to call this function?

Why do I get a NoClassDefFound error when I try to save my test plan?

Why I get error when I try to install pyaudio?

Why do I get this error when I try to load the component in VueJS?

Why do i get this error when I try installing autopep8 using pip?

Why I get error when I try to declare local variable?

Why do I get an Error when I try to rename a table after FROM?

Why do I get an error when I try to see my Text using useState?

Why I get an error when I try to upload a picture

Why do I get an error when I try to save mongoose model?

Why do I get error when try to convert Carbon to DateTime?

Gitlab CI: why do I get an error when I try to define the pages stage?

why do i get an error when i try to use my models?

Why do I get the error when I try to dereference a pointer to an array?