I have this excel file, I need to Search Hour and name filter and get row number. How can I do that ?
For example if the Name == "John"
and Hour == 12:00:00
return row number. How can I do this ?
I read data with this:
writer = pd.ExcelWriter(file_name, engine='openpyxl', mode='a', if_sheet_exists='overlay')
df = pd.read_excel(file_name, sheet_name="Today")
This values in 'Today' sheet. But I couldnt get row number two filter value. How can I do that ?
Edit:
According to comments I try with this:
writer = pd.ExcelWriter(file_name, engine='openpyxl', mode='a', if_sheet_exists='overlay')
df = pd.read_excel(file_name, sheet_name="Today")
df['Hour'] = pd.to_datetime(df['Hour'])
print(df)
a = df[(df["Name"] == "John") & (df['Hour'] == '12:00:00')].index + 1
print(a)
But print df returns:
Unnamed: 0 Name Surname Hour
0 NaN John Lake 1970-01-01
1 NaN Jennifer Brown 1970-01-01
2 NaN Dean Body 1970-01-01
3 NaN John Lake 1970-01-01
but my excel format like this: