Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/matplotlib/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ def date2num(d):
For details see the module docstring.
"""

if hasattr(d, "values"):
# this unpacks pandas series or dataframes...
d = d.values

if ((isinstance(d, np.ndarray) and np.issubdtype(d.dtype, np.datetime64))
or isinstance(d, np.datetime64)):
return _dt64_to_ordinalf(d)
Expand Down
4 changes: 4 additions & 0 deletions lib/matplotlib/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ def get_converter(self, x):
if classx is not None:
converter = self.get(classx)

if converter is None and hasattr(x, "values"):
# this unpacks pandas series or dataframes...
x = x.values

# If x is an array, look inside the array for data with units
if isinstance(x, np.ndarray) and x.size:
xravel = x.ravel()
Expand Down