diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index 3c9a67e04a92..2712d64291a7 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -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) diff --git a/lib/matplotlib/units.py b/lib/matplotlib/units.py index b1140ded00b0..6e0a0b78d2a8 100644 --- a/lib/matplotlib/units.py +++ b/lib/matplotlib/units.py @@ -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() pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy