I have two data frames that have same length like this
df1:
density
1 1,45
2 3,87
3 4,35
4 2,87
5 0.74
6 9.34
7 3.087
8 0.28
9 6,47
10 5,59
The second data frame looks like this
df2:
State
1 1
2 1
3 1
4 1
5 1
6 1
7 0
8 0
9 0
10 0
I want an output that looks like this which means filter df1 in order to keep only values where df2 is equal to 1 :
output:
density
1 1,45
2 3,87
3 4,35
4 2,87
5 0.74
6 9.34
How can I do that? Can you help me please.