Python Forum
TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'str'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'str'
#1
Can any one help me on this , unable to determince the reason behind the error while performing RFM analysis.

rfm= data_filtered.groupby('ProductID').agg({'Transaction Time': lambda date: (PRESENT - date.max()).days,
                                        'RetailStore': lambda num: len(num),
                                        'Cost': lambda price: price.sum()})
HELP NEEDED!!
Reply


Messages In This Thread
TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'str' - by findbikash - Sep-18-2019, 06:34 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  datetime module question jacksfrustration 10 1,762 Jan-12-2024, 04:54 AM
Last Post: deanhystad
  subtract 2 datetime string jss 4 791 Oct-19-2023, 02:42 PM
Last Post: Larz60+
  discrepancy with datetime with timezone XJia 3 791 Sep-03-2023, 02:58 PM
Last Post: deanhystad
  Type Error: Unsupported Operand jhancock 2 1,202 Jul-22-2023, 11:33 PM
Last Post: jhancock
  Review my code: convert a HTTP date header to a datetime object stevendaprano 1 2,006 Dec-17-2022, 12:24 AM
Last Post: snippsat
  TypeError: unsupported operand type(s) for +: 'dict' and 'int' nick12341234 1 9,334 Jul-15-2022, 04:04 AM
Last Post: ndc85430
  Trying to delete rows above a specific datetime value cubangt 19 11,524 May-09-2022, 08:57 PM
Last Post: deanhystad
  TypeError: unsupported opperand type(s) for %: 'int' and 'list' cool_person 7 2,177 May-07-2022, 08:40 AM
Last Post: ibreeden
  unsupported operand type(s) for %: 'list' and 'int' RandomCoder 4 32,888 May-07-2022, 08:07 AM
Last Post: menator01
  Problem with datetime [SOLVED] AlphaInc 3 2,775 Apr-22-2022, 01:33 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020