From da544e0177143b51a897b98df1adf428ad39dbd5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 26 Mar 2020 22:25:02 -0400 Subject: [PATCH] Backport PR #16906: update FAQ on how to register pandas converters --- doc/faq/howto_faq.rst | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/doc/faq/howto_faq.rst b/doc/faq/howto_faq.rst index 4c17fa503196..465bc94a2448 100644 --- a/doc/faq/howto_faq.rst +++ b/doc/faq/howto_faq.rst @@ -21,20 +21,12 @@ Plot `numpy.datetime64` values As of Matplotlib 2.2, `numpy.datetime64` objects are handled the same way as `datetime.datetime` objects. -If you prefer the pandas converters and locators, you can register their -converter with the `matplotlib.units` module:: - - from pandas.tseries import converter as pdtc - pdtc.register() - -If you only want to use the `pandas` converter for `numpy.datetime64` values :: - - from pandas.tseries import converter as pdtc - import matplotlib.units as munits - import numpy as np - - munits.registry[np.datetime64] = pdtc.DatetimeConverter() +If you prefer the pandas converters and locators, you can register them. This +is done automatically when calling a pandas plot function and may be +unnecessary when using pandas instead of Matplotlib directly. :: + from pandas.plotting import register_matplotlib_converters + register_matplotlib_converters() .. _howto-figure-empty: