1#Two ways to do this
2df[['parks', 'playgrounds', 'sports']].apply(lambda x: x.astype('category'))
3
4cols = ['parks', 'playgrounds', 'sports', 'roading']:
5public[cols] = public[cols].astype('category')
6
1#Method 1:
2df["Delivery Charges"] = df[["Weight", "Package Size", "Delivery Mode"]].apply(
3 lambda x : calculate_rate(*x), axis=1)
4
5#Method 2:
6df["Delivery Charges"] = df.apply(
7 lambda x : calculate_rate(x["Weight"],
8 x["Package Size"], x["Delivery Mode"]), axis=1)