Answers for "APPLY A FUNCTION USING TWO COLUMNS IN DATAFRAME"

1

plotting two columns of a dataframe in python

df.plot(x='col_name_1', y='col_name_2', style='o')
Posted by: Guest on January-29-2021
2

pandas pass two columns to function

#Method 1:
df["Delivery Charges"] = df[["Weight", "Package Size", "Delivery Mode"]].apply(
  lambda x : calculate_rate(*x), axis=1)

#Method 2:
df["Delivery Charges"] = df.apply(
  lambda x : calculate_rate(x["Weight"], 
  x["Package Size"], x["Delivery Mode"]), axis=1)
Posted by: Guest on May-14-2021

Code answers related to "APPLY A FUNCTION USING TWO COLUMNS IN DATAFRAME"

Python Answers by Framework

Browse Popular Code Answers by Language