I have the table below:
import pandas as pd
raw_data = {
'vendor_id': [1, 2, 3, 4, 5, 6],
'name': ['vendor_schmendor', 'parts_r_us', 'vendor_king', 'vendor_diagram', 'venny', 'vendtriloquist'],
'contract_sign_date': ['2018-09-01', '2018-09-03', '2018-10-11', '2018-08-21', '2018-08-13', '2018-10-29'],
'total_spend' :[34324, 23455, 77654, 23334, 94843, 23444]}
df = pd.DataFrame(raw_data, columns = ['vendor_id', 'name', 'contract_sign_date', 'total_spend'])
I was given a task where I have to drop all the rows where the contract_sign_date
is between "2018-09-01" and "2018-10-13", this is my solution (although it doesn't work):
alter = df.drop((df['contract_sign_date'] == "2018-09-01") & (df['contract_sign_date'] == "2018-10-13"))
The output throws: KeyError: '[False, False, False, False, False, False] not found in axis'
So can anyone provide a code so in order that I can construct what I was desired for?