関数で日付演算を実行しようとしています。
from datetime import datetime, timedelta
def foo(date1, summing_period):
current_period_start_date = date1 - timedelta(days=summing_period)
# Line above causes the error:
# TypeError: unsupported type for timedelta days component: datetime.datetime
最初の引数は日時オブジェクトで、2番目の引数は整数です
このエラーの原因とその修正方法を教えてください。