Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

remove rows from pandas dataframe that have text

df[df.columnName != 'text']
Comment

Delete row if contains certain text pandas

# importing the library
import pandas as pd
  
# Dataframe
df = pd.DataFrame({'team': ['Team 1', 'Team 1', 'Team 2',
                            'Team 3', 'Team 2', 'Team 3'],
                   'Subject': ['Math', 'Science', 'Science', 
                               'Math', 'Science', 'Math'],
                   'points': [10, 8, 10, 6, 6, 5]})
  
# Dropping the team 1
df = df[df["team"].str.contains("Team 1") == False]
  
df
Comment

PREVIOUS NEXT
Code Example
Python :: add title to relplot seaborn 
Python :: gurobi python example 
Python :: tkinter text editor 
Python :: to str python 
Python :: python plot horizontal line 
Python :: how to merge two variables to get an array in python 
Python :: get file in file zip python 
Python :: a string starts with an uppercase python 
Python :: scikit learn roc curve 
Python :: select default option django form 
Python :: encrypt password with sha512 + python 
Python :: how to see the whole dataset in jupyterlab 
Python :: print input in python 
Python :: sorting values in dictionary in python 
Python :: render() in django 
Python :: add reaction discord.py 
Python :: numpy linspace of dates 
Python :: installation of uvicorn for fastapi 
Python :: kivy dropdown list 
Python :: python function with two parameters 
Python :: multiprocessing pool pass additional arguments 
Python :: plot data python 
Python :: how to capitalize first letter in python in list using list comprehension 
Python :: reversed python 
Python :: regex_2/_regex.c:50:10: fatal error: Python.h: No such file or directory 
Python :: python argsort a list 
Python :: pandas add thousands separator 
Python :: classification cross validation 
Python :: py to exe 
Python :: anaconda 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =