I have DateFrame as shown below. I need to add a few columns to dft (pivot output). First one to calculate sum of products sold daily, it's like margine but only for sum column not len. I tried dft['Fruit Total']=df.iloc[:,0:3].sum(axis=1) but it didn't work. also I want to add column counting values > than 2 for each row in column sum. like in the picture
df = pd.DataFrame({
'date': ["22.10.2021", "22.10.2021", "22.10.2021", "23.10.2021", "23.10.2021", "25.10.2021", "22.10.2021", "23.10.2021", "22.10.2021", "25.10.2021"],
'Product': ["apple", "apple", "orange", "orange", "apple","apple", "apple", "orange", "orange", "orange"],
'sold_kg': [2, 3, 1, 6, 2,2, 3, 1, 6, 2,]})
df['day']=pd.to_datetime(df['date']).dt.day
dft=df.pivot_table(values='sold_kg', columns ='day', index='Product', aggfunc=[np.sum,len])
dft
