Python, Pandas, Data Science, Machine Learning, Pandas Dataframe.
Filtering Regular method to filter: %timeit df_filtered = df[df["Car"] == "Mercedes"] #61.8 ms ± 2.55 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) For categorical features, we can utilize the group_by and get_group methods in Pandas. %timeit df.groupby("Car").get_group("Mercedes") #92.1 ms