# Get the value in a column when the according to condition in another column value approximately equal

I have a dataframe

``````      using DataFrames
df1=DataFrame(p1 = [10, 20, 30,40,50], p2 = [50,5, 60,70.2,40])
``````

I wanted to get the value of column p1, when the value of p2 is approximately equal to my input
I have filtered the required one by

id=df1[in(40).(df1.p2), :p1]

I wanted to modify the such that I will get the same result even if the given value is approximately equal. Instead of 40, 40.5 should also work or just when the value >=40 (first occurrence)

Just use a condition with a desired precision, e.g.:

``````julia> df1[25 .< df1.p2 .< 55, :p1]
2-element Vector{Int64}:
10
50
``````

to get all rows where `p2` is in `[25, 55]` range.