Skip to content

PERF: improve perf of float-based timeseries plotting #15073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
3 changes: 3 additions & 0 deletions asv_bench/benchmarks/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions doc/source/whatsnew/v0.20.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pandas/tseries/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions pandas/tseries/tests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down