I want to look up the row that contains Transitioning EIN in the Unnamed 17 column and the date of 2021-01-29 in Unnamed 13 column. pic
I tried this:
df.loc[(df['Unnamed: 17']=='Transitioning EIN') & (df['Unnamed: 13']=="2021-01-29 00:00:00")]
which returns an empty dataframe. i can get the df back if i put just the transitioning ein condition but when i add in the date column condition it doesnt work. Any idea why?
Try to read your datafile using skiprows=5
before:
# or pd.read_csv('file.csv') if you have a csv file
df = pd.read_excel('file.xlsx', skiprows=5, parse_dates=['Date Terminated'])
Then use:
m1 = df['Date Terminated'] == '2021-01-29 00:00:00'
m2 = df['Termination Type'] == 'Transitioning EIN'
df.loc[m1 & m2]