Hi there,
I have two dataframes:
df1=DataFrame(Student=["Abel", "Beatriz", "Beatriz", "Caio", "Dario", "Dario"],Class=["12", "12", "10", "11", "13", "14"], Professor=["John", "John", "Jack", "Moe", "Heather", "Lisa"], P1=[7.8, 4.2, 6.9, 3.0, 1.3, 8.2])
6×4 DataFrame
Row │ Student Class Professor P1
│ String String String Float64
─────┼─────────────────────────────────────
1 │ Abel 12 John 7.8
2 │ Beatriz 12 John 4.2
3 │ Beatriz 10 Jack 6.9
4 │ Caio 11 Moe 3.0
5 │ Dario 13 Heather 1.3
6 │ Dario 14 Lisa 8.2
and
df2=DataFrame(Student=["Abel", "Beatriz", "Caio", "Beatriz", "Dario", "Dario"],Class=["12", "12", "11", "10", "13", "14"], Status=["Active
", "Active", "Active", "Inactive", "Inactive", "Active"])
6×3 DataFrame
Row │ Student Class Status
│ String String String
─────┼───────────────────────────
1 │ Abel 12 Active
2 │ Beatriz 12 Active
3 │ Caio 11 Active
4 │ Beatriz 10 Inactive
5 │ Dario 13 Inactive
6 │ Dario 14 Active
I would like to “clean” df1, so that its rows which correspond to df2.Status.==“Inactive” are suppressed and the final df1 dataframe turns out to be:
df1_cleaned = DataFrame(Student=["Abel", "Beatriz", "Caio", "Dario"], Class=["12", "12", "11", "14"], Professor=["John", "John", "Moe", "Lisa"], P1=["7.8", "4.2", "3.0", "8.2"])
4×4 DataFrame
Row │ Student Class Professor P1
│ String String String Float64
─────┼─────────────────────────────────────
1 │ Abel 12 John 7.8
2 │ Beatriz 12 John 4.2
3 │ Caio 11 Moe 3.0
4 │ Dario 14 Lisa 8.2
Things I have tried involved:
unique
functionjoin
DataFrames operations
but I really could not find my way out…
Thanks in advance.