[PYTHON] Extract lines containing a specific "string" in Pandas

The other day, I summarized the basic Pandas condition extraction. [https://qiita.com/M_Faust/items/05a79e0372bf9c9003e5][1] [1]:https://qiita.com/M_Faust/items/05a79e0372bf9c9003e5

The condition extraction when a specific character string is included for the DataFrame whose type is a character string is as follows.

Condition extraction when a specific character string is included


>>> df = pd.DataFrame ({"A":["hello","helloa","ahello","bye"]})
>>> df_extract = df.query ("A.str.contains ('hello')",engine="python")
>>> df_extract
        A
0   hello
1  helloa
2  ahello

I run an app that makes money for environmental beautification activities (I will post it because Python is used in Backend). [https://play.google.com/store/apps/details?id=com.rainbowsv2.changetheworld&hl=ja][2] [2]:https://play.google.com/store/apps/details?id=com.rainbowsv2.changetheworld&hl=ja

Recommended Posts

Extract lines containing a specific "string" in Pandas
Read a file containing garbled lines in Python
Tips: [Python] Extract only lines that do not contain a specific string
Get a row containing a specific element in np.where
Count specific strings in a file
Create a pandas Dataframe from a string.
Save a specific variable in tensorflow.session
Extract specific multiple columns with pandas
Create a random string in Python
[Golang] Check if a specific character string is included in the character string
How to get a specific column name and index name in pandas DataFrame
# 5 [python3] Extract characters from a character string
Get a Unicode JSON string containing Japanese.
String conversion of a list containing numbers
How to write a string when there are multiple lines in python
Generate a class from a string in Python
Use BeautifulSoup to extract a link containing a string from an HTML file
Note) Batch conversion of specific symbols contained in a character string with a dictionary
How to embed a variable in a python string
Enable Django https in just a few lines
Create a protein sequence mutation library in pandas
Language processing 100 knocks-21: Extract lines containing category names
Sort dict in dict (dictionary in dictionary) with a specific key
Create a datetime object from a string in Python (Python 3.3)
Enter a specific value for variable in tensorflow
Create a package containing global commands in Python
How to count numbers in a specific range
Put out a shortened URL string in Python
Insert an object inside a string in Python
[Python] Leave only the elements that start with a specific character string in the array
A script that transfers tweets containing specific Twitter keywords to Slack in real time
Check if the string is a number in python
How to convert / restore a string with [] in python
I want to embed a variable in a Python string
Various ways to extract columns in a NumPy array
How to write string concatenation in multiple lines in Python
Extract elements other than a specific index with Numpy
[Python] How to expand variables in a character string
Save tweets containing specific keywords in CSV on Twitter
Output a character string with line breaks in PyYAML
Extract the element by deleting the tag contained in the string
Extract only elements that meet specific conditions in Python
Stop an instance with a specific tag in Boto3
A Python program that collects tweets containing specific keywords daily and saves them in csv