Let say I have below code,
import pandas as pd
dat = pd.DataFrame({'col1' : [1,2,3,4,5,6,7,8,9,10], 'col2' : ['A', 'X', 'D', 'Y', 'A', 'D', 'Y', 'X', 'D', 'A']})
dat1 = pd.DataFrame({'col1' : [1,2,3,4,5,6,7,8,9,10], 'col2' : ['A', 'X', 'D', 'Y', 'A', 'D', 'Y', 'X', 'D', 'A']})
number = dat['col1'].values[dat.shape[0] - 3]
dat1.query("col1 == @number")
now instead of using @number in the last line, I want pass entire calculation dat['col1'].values[dat.shape[0] - 3] in the query method.
Is there any way to achieve this?