Python Forum
Error Message Coming Up When Running Code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error Message Coming Up When Running Code
#1
Hi there,

I have an Traceback Error, associated with the following line, of the Python Code I have :-

groupby_venue_date = selected.groupby(['Venue', 'BID', 'Date', 'DISPLAY/', 'Durn-Total'])
Which gives the following Traceback Error :-

Error:
File "<ipython-input-278-b2b43ed053c7>", line 47 groupby_venue_date = selected.groupby(['Venue', 'BID', 'Date', 'DISPLAY/', 'Durn-Total']) ^ SyntaxError: invalid syntax
It is proceeded by the following Line of Code :-

df['Durn-Total'] = df['Durn'].groupby(df['Venue'].sum()
With that line of Code, I am trying to Group the DataFrame Data, by the Column 'Venue', and Sum by the 'Durn' Row, creating a new Column 'Durn-Total' is that correct ? I was wondering if that line is causing the Error I am getting ? Could Someone suggest to me, what is causing the Error ?

Also I meant to say, I had an ')' bracket around the 'Venue' part of the Code, so saying :-

df['Durn-Total'] = df['Durn'].groupby(df['Venue']).sum()
But that gave an Traceback Error Of :-

Error:
TypeError: unsupported operand type(s) for +: 'datetime.time' and 'datetime.time'
And I am unsure, how to fix that Error in Code. I am assuming it's because calculations, can't be done, in the Time Format, the Values in the 'Durn' Column are, at that point in the Code ?

Any help would be appreciated

Regards

Eddie Winch
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  problem in running a code akbarza 7 541 Feb-14-2024, 02:57 PM
Last Post: snippsat
  writing and running code in vscode without saving it akbarza 1 344 Jan-11-2024, 02:59 PM
Last Post: deanhystad
  the order of running code in a decorator function akbarza 2 477 Nov-10-2023, 08:09 AM
Last Post: akbarza
  error "cannot identify image file" part way through running hatflyer 0 612 Nov-02-2023, 11:45 PM
Last Post: hatflyer
  Error message about iid from RandomizedSearchCV Visiting 2 932 Aug-17-2023, 07:53 PM
Last Post: Visiting
  Error when running kivy on python janeik 8 1,920 Jun-16-2023, 10:58 PM
Last Post: janeik
  Another Error message. the_jl_zone 2 942 Mar-06-2023, 10:23 PM
Last Post: the_jl_zone
  Getting error when running "MINUS" between 2 databases marlonbown 4 1,217 Nov-10-2022, 05:49 AM
Last Post: deanhystad
  Code running many times nad not just one? korenron 4 1,324 Jul-24-2022, 08:12 AM
Last Post: korenron
  Error while running code on VSC maiya 4 3,540 Jul-01-2022, 02:51 PM
Last Post: maiya

Forum Jump:

User Panel Messages

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