train[['Pclass', 'Age']].groupby(['Pclass'], as_index=False).median().sort_values(by='Pclass', ascending=True)
This is the bit where I am doing the grouping, finding the summary statistics, and sorting it based on a column ('Pclass' in this case).
How can I use a where clause along with this? The where clause I want to enter would perform something similar to train[train.Survived==1]
Any thoughts on how this can be achieved? I am using the classic "Titanic" dataset.