0

I am trying to remove a list of accounts from a CSV and delete/exclude whatever row they were in. The accounts are in two separate columns.

I've tried using isin to exclude them, but it just removes the strings and not the whole row.

import pandas as pd
cols = ['samaccountname', 'employeeid', 'manager', 'title']
df = pd.read_csv('accounts.csv', usecols=[0,1,2,4], header=0, names=cols)
acs = ['josmith', 'jesmith']

samaccountname employeeid manager title
josmith        12345      adsmith president
jpsmith        67890      jesmith advisor
jadoe          10000      jpsmith supervisor

Output should look like this.

samaccountname employeeid manager title
jadoe          10000      jpsmith supervisor
pystackit
  • 7
  • 1
  • 5

1 Answers1

0

Try this. I have not tested

 print (df.tail(1))
Bharath
  • 113
  • 1
  • 1
  • 10