Screening is used very frequently in daily work functions previously introduced loc and screening methods iloc now continue to introduce some method of screening.
In>, <, ==,> =, <= be selected ( "equals" must be a '==', if the '=' the size is not determined):
Using & (and) and | (or) with each condition must be enclosed in parentheses.
Select multiple rows must be two brackets, wherein the inner side of the square brackets is representative of a list:
If you want to select a column to multiple values or strings to use .isin (), we modified a bit df ( ISIN () brackets should be a List ):
Usually the most used screening should be screened fuzzy string, used in an SQL statement is like, where the pandas we can use .str.contains () to achieve.
You can also use '|' to be screened multiple conditions:
Note that, the '|' is in quotation marks, instead of the two strings are in quotes. '&' Can not be used here.
If the middle of .str not the case, an error occurs, it is suggesting that 'Series' array is not 'contains' function.
In fact, the role is .str 'Series' is converted into Strings similar structure, then you can use the function contains.
Author: Exploring the beauty of data
link: https://www.jianshu.com/p/805f20ac6e06
Source: Jane book
Jane book copyright reserved by the authors, are reproduced in any form, please contact the author to obtain authorization and indicate the source.