I want to filter though my dataset using conditions. I tried using .isin() function but i got an empty dataframe when filtering an np.array float list. Here is my code
f1 = []
f2 = []
f3 = []
f4 = []
for c in range(100):
x = (2 * c) + 28
y = ((9 * c)/5) + 32
z = abs(x-y)
f1.append(x)
f2.append(y)
f3.append(c)
f4.append(z)
columns=['Temp in Celsius', 'Norm Temp in F', 'Make shift Temp in F', 'Absolute Diff btw formulas']
df = pd.DataFrame([f3,f2,f1,f4]).transpose()
df.columns=columns
print(df[df['Absolute Diff btw formulas'].isin(np.arange(0.1, 0.9, 0.1))])
The values i am searching for in the column 'Absolute Diff btw formulas' is actually present because when i run df[15:25] i get this
print(df[15:25])
Temp in Celsius Norm Temp in F Make shift Temp in F Absolute Diff btw formulas
15 15.0 59.0 58.0 1.0
16 16.0 60.8 60.0 0.8
17 17.0 62.6 62.0 0.6
18 18.0 64.4 64.0 0.4
19 19.0 66.2 66.0 0.2
20 20.0 68.0 68.0 0.0
21 21.0 69.8 70.0 0.2
22 22.0 71.6 72.0 0.4
23 23.0 73.4 74.0 0.6
24 24.0 75.2 76.0 0.8
So, how can i go about it using the .isin() function or any conditional statement. The goal is to printout the dataframe with df['Absolute Diff btw formulas'] values of range 0.1 to 0.9 .Thanks