I am trying to read and filter from excel data in Python. I used the code below:
import pandas as pd
import numpy as np
df = pd.read_excel('file.xlsx')
df['apples'] = (pd.cut(df['apples'],bins=[-np.inf,2,5,np.inf],labels=['WOW','ok','BOB']))
print(df)
But KeyError: 'apples' occurs. Do you have any advice about how can I fix this?