I have a dataframe with column names as "entity" and "definition". For example:
df['entity']
and df['definition']
where the 1st column has certain entity names and the second column has the definition. However for certain entities the definition has the word "None". I want to remove those rows which have the word "None" from the dataframe. I am attaching a screenshot of the same. Any lead on how to proceed?
Asked
Active
Viewed 101 times
-1

Pritam Deka
- 23
- 1
- 6
-
Please go through the [intro tour](https://stackoverflow.com/tour), the [help center](https://stackoverflow.com/help) and [how to ask a good question](https://stackoverflow.com/help/how-to-ask) to see how this site works and to help you improve your current and future questions, which can help you get better answers. "Show me how to solve this coding problem?" is off-topic for Stack Overflow. You have to make an honest attempt at the solution, and then ask a *specific* question about your implementation. Stack Overflow is not intended to replace existing tutorials and documentation. – Prune Feb 06 '21 at 18:22
-
Off-site links and images of text are not acceptable, in keeping with the purpose of this site. – Prune Feb 06 '21 at 18:22
-
This image is of the output of my code – Pritam Deka Feb 06 '21 at 18:26
2 Answers
0
You can use drop
import pandas as pd
df = pd.DataFrame({"entity" : ["a", "b", "c"]})
df['Definition'] = ["None","b", "c"]
df.drop(df[df['Definition']=="None"].index, inplace = True)
df.head()

Vidya Ganesh
- 788
- 11
- 24