So I have a dataframe (Df1) of say 100 rows. I also have a dataframe (df2) which contains 1 row. For each data frame, a row represents a property. The columns in question are 'NIY' and 'Purchase Price'. I want to write a function that queries DF1 to show results where the NIY is within 0.1 of DF2 and the purchase price is within 2,000,000 of DF2.

DF1 contains multiple columns, of which contain 'NIY' & 'Purchase Price'.

| Purchase\_Price | NIY | Purchaser |
| --- | --- | --- |
| 230000000 | 0.15 | GS |
| 30000000 | 0.08 | JKK |

See code below

```
df1 = pd.read_csv('CopyTransactions.csv', header=3)

df2 = {'Purchase_Price': [25300000], 'NIY': [0.078]}
df2 = pd.DataFrame(data=df2)
df1.query('Purchase_Price > 1000000 & NIY > 0.09')

df1.query('NIY within range g.0['NIY'] + or - 0.01 
     & Purchase_price within range g.0['Purchase_Price'] + or - 2,000,000)

```

The code works until the bottom part, I want to work out how to correctly code the bottom section. (the 0 in the bottom code means index 0/first row)

Thanks!