Skip to content

Commit 89bdb1e

Browse files
author
Dieter Vandenbussche
committed
Fix plotting with datetime.date index values
1 parent 96bd0db commit 89bdb1e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3828,7 +3828,7 @@ def plot(self, subplots=False, sharex=True, sharey=False, use_index=True,
38283828

38293829
if kind == 'line':
38303830
if use_index:
3831-
if self.index.is_numeric() or self.index.is_datetime():
3831+
if self.index.is_numeric() or self.index.is_datetype():
38323832
"""
38333833
Matplotlib supports numeric values or datetime objects as
38343834
xaxis values. Taking LBYL approach here, by the time

pandas/core/index.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pylint: disable=E1101,E1103,W0232
22

3-
from datetime import time, datetime
3+
from datetime import time, datetime, date
44
from itertools import izip
55

66
import numpy as np
@@ -145,9 +145,9 @@ def is_monotonic(self):
145145
def is_numeric(self):
146146
return issubclass(self.dtype.type, np.number)
147147

148-
def is_datetime(self):
148+
def is_datetype(self):
149149
for key in self.values:
150-
if not isinstance(key, datetime):
150+
if not isinstance(key, (datetime, date)):
151151
return False
152152
return True
153153

pandas/core/series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2076,7 +2076,7 @@ def plot(self, label=None, kind='line', use_index=True, rot=30, ax=None,
20762076

20772077
if kind == 'line':
20782078
if use_index:
2079-
if self.index.is_numeric() or self.index.is_datetime():
2079+
if self.index.is_numeric() or self.index.is_datetype():
20802080
"""
20812081
Matplotlib supports numeric values or datetime objects as
20822082
xaxis values. Taking LBYL approach here, by the time

0 commit comments

Comments
 (0)