Challenge: Screen Compounds Against Target Properties
Task
Swipe to start coding
Write a function rank_candidates that takes a pandas DataFrame with two columns: smiles (molecular SMILES strings) and predicted_activity (numerical scores). Your function should:
- Sort the DataFrame by
predicted_activityin descending order; - Assign a new column
rankwith integer ranks (1 for highest score, 2 for next, etc.); - Return the ranked DataFrame with the new
rankcolumn included.
You should not modify the input DataFrame in-place; return a new DataFrame.
Solution
Everything was clear?
Thanks for your feedback!
Sectionย 3. Chapterย 4
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 6.25
Challenge: Screen Compounds Against Target Properties
Swipe to show menu
Task
Swipe to start coding
Write a function rank_candidates that takes a pandas DataFrame with two columns: smiles (molecular SMILES strings) and predicted_activity (numerical scores). Your function should:
- Sort the DataFrame by
predicted_activityin descending order; - Assign a new column
rankwith integer ranks (1 for highest score, 2 for next, etc.); - Return the ranked DataFrame with the new
rankcolumn included.
You should not modify the input DataFrame in-place; return a new DataFrame.
Solution
Everything was clear?
Thanks for your feedback!
Sectionย 3. Chapterย 4
single