I created a function that strips the '$' in the number and converts it to float then add the total sum in the column. And when I tried calling that function to the groupby, I am getting an error. Here's the code:
def total_sales():
return df['Total sales USD'].str.strip('$').astype(float).sum()
df_order_sales_date = df.groupby(['column1','column2']).apply(total_sales)
Im getting an error that says 'TypeError: total_sales() takes 0 positional arguments but 1 was given'
What should I do? Is it possible to create a function that strips the $, converts the string to float and add the total then apply it to the columns in groupby? Thanks for the help