Python Forum
Help: how to deal with a invalid Matplotlib date value when use {gca()}
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help: how to deal with a invalid Matplotlib date value when use {gca()}
#2
Hi,

Your code seems to work on my computer. I just have change the xls typ eto csv. You might want to try that line to import csv:
df = pd.read_csv(csv_source)

What version of matplotlib do you use?

Otherwise I would suggest you to build your figure like this:

f, ax = plt.subplots(1)

So you don't have to use ax = plt.gca(). Then continue:

df.plot(kind='line', x='Ship Date', y='Profit', color='red', ax=ax)
df.plot(kind='line', x='Ship Date', y='Sales', color='blue', ax=ax)
plt.show()

But I doubt that is the root cause of the error message you got, it's more like a workaround...
Reply


Messages In This Thread
RE: Help: how to deal with a invalid Matplotlib date value when use {gca()} - by Giska - Oct-17-2018, 01:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  replace nan values by mean group by date.year, date.month wissam1974 5 10,842 Feb-19-2020, 06:25 PM
Last Post: AnkitGupta
  %matplotlib inline , invalid syntax yamoon 1 14,864 Jul-12-2018, 07:22 AM
Last Post: volcano63
  Finding date count from a list of date range in pandas trillerducas72 0 3,342 May-24-2018, 02:30 AM
Last Post: trillerducas72
  how to deal with varying value-counts().keys() in pandas dataframe dilmailid 4 5,950 May-16-2018, 09:28 AM
Last Post: dilmailid

Forum Jump:

User Panel Messages

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