I have a excel file, has file name and a value, for example:
file. count
001.txt 1
002.txt 2
003.txt 2
004.txt 3
005.txt 1
006.txt 2
I'm using the following code to find how many 2s are in the value column, but somehow the result is 0
df = pd.read_excel('report.xlsx')
df.columns = ['file', 'count']
count = df['count'].tolist().count('2')
print(count)
>>0
Did I do something wrong in the code?