Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plotting by Time, error
#1
Hi

Observing following error while plotting the series by time


Error:
TypeError: float() argument must be a string or a real number, not 'datetime.time'
tickets_df['Time']=tickets_df['book_date'].dt.time
x=tickets_df.groupby('Time')[['Time']].count()

plt.figure(figsize=(18,6))
plt.plot(x.index, x['Time'],marker="^")      # << giving me error on this line ---
plt.xlabel('Time', fontsize=20)
plt.ylabel('Number of Tickets', fontsize=20)
plt.grid('b')
plt.show()
buran write May-16-2023, 07:14 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply
#2
There is a sample of time plot (from pandas) here.
I tried their sample and it functions as stated.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Non-blocking real-time plotting slow_rider 5 3,664 Jan-07-2023, 09:47 PM
Last Post: woooee
Exclamation Error when plotting a graph. Oshadha 3 3,660 Mar-14-2022, 06:47 PM
Last Post: deanhystad
  time setup for realtime plotting of serial datas at high sampling rate alice93 6 3,764 Jan-07-2022, 05:41 PM
Last Post: deanhystad
  Plotting A Time Series With Shaded Recession Bars adamszymanski 1 3,169 Jan-24-2021, 09:08 PM
Last Post: nealc
  Time Limit Exceeded error loves 5 3,163 Dec-03-2020, 07:15 AM
Last Post: Sofia_Grace
  Time conversion error tester_V 1 2,037 Oct-28-2020, 10:48 PM
Last Post: tester_V
  Error When Plotting ValueError: x and y must have same first dimension JoeDainton123 1 9,112 Oct-04-2020, 12:58 PM
Last Post: scidam
  Read CSV error: python KeyError: 'Time' charlicruz 1 5,180 Jun-27-2020, 09:56 AM
Last Post: charlicruz
  save in CSV and plotting in real time linkxxx 8 5,690 Sep-01-2019, 12:24 PM
Last Post: buran
  Error when running the second time metro17 3 3,766 Aug-30-2019, 12:09 PM
Last Post: ThomasL

Forum Jump:

User Panel Messages

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