Answers for "drop row with value pandas"

3

python - exclude rowin data frame based on value

df = df[df.myvar != 0]
df = df[df.myvar < 2]
Posted by: Guest on September-07-2020
4

pandas drop rows with value in list

import pandas as pd

a = ['2015-01-01' , '2015-02-01']

df = pd.DataFrame(data={'date':['2015-01-01' , '2015-02-01', '2015-03-01' , '2015-04-01', '2015-05-01' , '2015-06-01']})

print(df)
#         date
#0  2015-01-01
#1  2015-02-01
#2  2015-03-01
#3  2015-04-01
#4  2015-05-01
#5  2015-06-01

df = df[~df['date'].isin(a)]

print(df)
#         date
#2  2015-03-01
#3  2015-04-01
#4  2015-05-01
#5  2015-06-01
Posted by: Guest on July-14-2020
1

drop row pandas column value not a number

In [215]:

df[df['entrytype'].apply(lambda x: str(x).isdigit())]
Out[215]:
  entrytype
0         0
1         1
4         2
Posted by: Guest on September-03-2020

Code answers related to "drop row with value pandas"

Python Answers by Framework

Browse Popular Code Answers by Language