diff --git a/asv_bench/benchmarks/plotting.py b/asv_bench/benchmarks/plotting.py index 3350ddaccc496..757c3e27dd333 100644 --- a/asv_bench/benchmarks/plotting.py +++ b/asv_bench/benchmarks/plotting.py @@ -20,6 +20,9 @@ def setup(self): def time_plot_regular(self): self.df.plot() + def time_plot_regular_compat(self): + self.df.plot(x_compat=True) + class Misc(object): goal_time = 0.6 diff --git a/doc/source/whatsnew/v0.20.0.txt b/doc/source/whatsnew/v0.20.0.txt index 8b6b765a81dba..da13f724eb663 100644 --- a/doc/source/whatsnew/v0.20.0.txt +++ b/doc/source/whatsnew/v0.20.0.txt @@ -281,10 +281,14 @@ Performance Improvements - Improved performance of ``pd.wide_to_long()`` (:issue:`14779`) - Increased performance of ``pd.factorize()`` by releasing the GIL with ``object`` dtype when inferred as strings (:issue:`14859`) +- Improved performance of timeseries plotting with an irregular DatetimeIndex + (or with ``compat_x=True``) (:issue:`15073`). + - When reading buffer object in ``read_sas()`` method without specified format, filepath string is inferred rather than buffer object. + .. _whatsnew_0200.bug_fixes: Bug Fixes diff --git a/pandas/tseries/converter.py b/pandas/tseries/converter.py index 8f8519a498a31..95ff9578fa3ee 100644 --- a/pandas/tseries/converter.py +++ b/pandas/tseries/converter.py @@ -212,7 +212,7 @@ def try_parse(values): try: values = tools.to_datetime(values) if isinstance(values, Index): - values = values.map(_dt_to_float_ordinal) + values = _dt_to_float_ordinal(values) else: values = [_dt_to_float_ordinal(x) for x in values] except Exception: diff --git a/pandas/tseries/tests/test_converter.py b/pandas/tseries/tests/test_converter.py index 7e4ed288e31c1..37d9c35639c32 100644 --- a/pandas/tseries/tests/test_converter.py +++ b/pandas/tseries/tests/test_converter.py @@ -3,7 +3,7 @@ import nose import numpy as np -from pandas import Timestamp, Period, Index +from pandas import Timestamp, Period from pandas.compat import u import pandas.util.testing as tm from pandas.tseries.offsets import Second, Milli, Micro @@ -104,8 +104,8 @@ def test_dateindex_conversion(self): for freq in ('B', 'L', 'S'): dateindex = tm.makeDateIndex(k=10, freq=freq) rs = self.dtc.convert(dateindex, None, None) - xp = Index(converter.dates.date2num(dateindex._mpl_repr())) - tm.assert_index_equal(rs, xp, decimals) + xp = converter.dates.date2num(dateindex._mpl_repr()) + tm.assert_almost_equal(rs, xp, decimals) def test_resolution(self): def _assert_less(ts1, ts2):