I would like to slice a pandas.DataFramethat satisfies condition A or condition B. Most of the search results show how to cut the data frame with and . So I'm wondering if it is possible to use the "or" operator without converting (A and B) to (not (not A, not B))? Because sometimes there are many “or” conditions, and conversion can be difficult.
pandas.DataFrame
I tried using:
df[(df['c1']==x1) or (df['c2']==x2)]
but that will not work.
You need to use a boolean or character |
|
df[(df['c1'] == x1) | (df['c2'] == x2)]
and &
and
&
df[(df['c1'] == x1) & (df['c2'] == x2)]
Source: https://habr.com/ru/post/1651346/More articles:How to remove ALL metadata using ffmpeg? - ffmpegReading parameter keys / values from file to shell script - bashBuilding a symbolic result for a particular solution of a differential equation - pythonTry with resources that are not supported at this language level - javaПочему это выражение соответствия F # вложенности не работает правильно? - pattern-matchingWhen to update a Firebase3 (Web) token for an API request - javascriptGC spark operator accepts long - apache-sparkhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1651349/good-ways-to-use-a-fork-of-type-definition-like-types&usg=ALkJrhidDTTpq2ngcT12iIku4v-_JXpe7QRemoving old numbers with a VCF file - androidswift2.0 returning information from REST calls (Alamofire) - iosAll Articles