There is a "grass" Pandas dataframe: pid Name Class 1 Class 2 HP Attack Defense Sp. Atk Sp. Def Speed Legendary 0 1 Bulbasaur Grass Poison 45 49 49 65 65 45 False 1 2 Ivysaur Grass Poison 60 62 63 80 80 60 False 2 3 Venusaur Grass Poison 80 82 83 100 100 80 False 3 4 Mega Venusaur Grass Poison 80 100 123 122 120 80 False 48 49 Oddish Grass Poison 45 50 55 75 65 30 False Write a function that will search for 'Rock' values in the Class 1 and Class 2 columns. And if it finds such values it will delete these rows.
import pandas as pd data = pd.read_csv('pokemon.csv') def delete(data): for i in range(len(data)): if data['Class 1'][i] == 'Rock' or data['Class 2'][i] == 'Rock': data = data.drop([i]) return data delete(data)