# A new dataframe is created based on the rows of df where Age [h] is the maximum for each Batch ID group
# The new dataframe contains only the rows of the original dataframe, where Age [h] is the maximum
maxAge = df[df.groupby(['Batch ID'])["Age [h]"].transform(max) == df["Age [h]"]]
# Many row selection conditions can be applied together on a dataframe
# Here a new, filtered dataframe is created which satisfies 3 different conditions from 3 columns
df2 = df[(df['Product'] == "Met1") & (df['Max titer [g/L]'] > 50) & (df["Success label"] != "Failed")]
# Creating a new dataframe with "contains"
# When similar strings have to found in a column
df_gallery_samples = df_sample_query[df_sample_query["assay"].str.contains("Gallery")]