df.drop(df.loc[df['line_race']==0].index, inplace=True)
#to drop rows based on certain condition in a column
import pandas as pd
df = df[df['column']!=1]
df = df[df.line_race != 0]
def filter_rows_by_values(df, col, values):
return df[~df[col].isin(values)]
In [215]:
df[df['entrytype'].apply(lambda x: str(x).isdigit())]
Out[215]:
entrytype
0 0
1 1
4 2
# create a new dataframe CONTAINING ONLY the rows, where the value
# of some_column = some_value
new_df = old_df.loc[old_df['some_column']=='some_value']
# create a new dataframe EXCLUDING the rows, where the value of
# some_column = some_value
new_df = old_df.loc[old_df['some_column']!='some_value']