Skip to content

Commit

Permalink
Fix plotting with datetime.date index values
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieter Vandenbussche committed Mar 3, 2012
1 parent 96bd0db commit 89bdb1e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3828,7 +3828,7 @@ def plot(self, subplots=False, sharex=True, sharey=False, use_index=True,

if kind == 'line':
if use_index:
if self.index.is_numeric() or self.index.is_datetime():
if self.index.is_numeric() or self.index.is_datetype():
"""
Matplotlib supports numeric values or datetime objects as
xaxis values. Taking LBYL approach here, by the time
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/index.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pylint: disable=E1101,E1103,W0232

from datetime import time, datetime
from datetime import time, datetime, date
from itertools import izip

import numpy as np
Expand Down Expand Up @@ -145,9 +145,9 @@ def is_monotonic(self):
def is_numeric(self):
return issubclass(self.dtype.type, np.number)

def is_datetime(self):
def is_datetype(self):
for key in self.values:
if not isinstance(key, datetime):
if not isinstance(key, (datetime, date)):
return False
return True

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2076,7 +2076,7 @@ def plot(self, label=None, kind='line', use_index=True, rot=30, ax=None,

if kind == 'line':
if use_index:
if self.index.is_numeric() or self.index.is_datetime():
if self.index.is_numeric() or self.index.is_datetype():
"""
Matplotlib supports numeric values or datetime objects as
xaxis values. Taking LBYL approach here, by the time
Expand Down

0 comments on commit 89bdb1e

Please sign in to comment.