From 00102b83002b95a53a68d48afbb293dfaef35cf8 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Sun, 10 Mar 2019 19:19:10 -0700 Subject: [PATCH 1/4] CLN: Remove Panel benchmarks --- asv_bench/benchmarks/indexing.py | 14 +------ asv_bench/benchmarks/join_merge.py | 27 +------------ asv_bench/benchmarks/panel_ctor.py | 55 --------------------------- asv_bench/benchmarks/panel_methods.py | 25 ------------ 4 files changed, 2 insertions(+), 119 deletions(-) delete mode 100644 asv_bench/benchmarks/panel_ctor.py delete mode 100644 asv_bench/benchmarks/panel_methods.py diff --git a/asv_bench/benchmarks/indexing.py b/asv_bench/benchmarks/indexing.py index 57ba9cd80e55c..b8e983c60b8b5 100644 --- a/asv_bench/benchmarks/indexing.py +++ b/asv_bench/benchmarks/indexing.py @@ -2,7 +2,7 @@ import numpy as np import pandas.util.testing as tm -from pandas import (Series, DataFrame, Panel, MultiIndex, +from pandas import (Series, DataFrame, MultiIndex, Int64Index, UInt64Index, Float64Index, IntervalIndex, CategoricalIndex, IndexSlice, concat, date_range) @@ -277,18 +277,6 @@ def time_get_indexer_list(self, index): self.data.get_indexer(self.cat_list) -class PanelIndexing(object): - - def setup(self): - with warnings.catch_warnings(record=True): - self.p = Panel(np.random.randn(100, 100, 100)) - self.inds = range(0, 100, 10) - - def time_subset(self): - with warnings.catch_warnings(record=True): - self.p.ix[(self.inds, self.inds, self.inds)] - - class MethodLookup(object): def setup_cache(self): diff --git a/asv_bench/benchmarks/join_merge.py b/asv_bench/benchmarks/join_merge.py index 6da8287a06d80..d0a60bdff826a 100644 --- a/asv_bench/benchmarks/join_merge.py +++ b/asv_bench/benchmarks/join_merge.py @@ -3,7 +3,7 @@ import numpy as np import pandas.util.testing as tm -from pandas import (DataFrame, Series, Panel, MultiIndex, +from pandas import (DataFrame, Series, MultiIndex, date_range, concat, merge, merge_asof) try: @@ -66,31 +66,6 @@ def time_concat_mixed_ndims(self, axis): concat(self.mixed_ndims, axis=axis) -class ConcatPanels(object): - - params = ([0, 1, 2], [True, False]) - param_names = ['axis', 'ignore_index'] - - def setup(self, axis, ignore_index): - with warnings.catch_warnings(record=True): - panel_c = Panel(np.zeros((10000, 200, 2), - dtype=np.float32, - order='C')) - self.panels_c = [panel_c] * 20 - panel_f = Panel(np.zeros((10000, 200, 2), - dtype=np.float32, - order='F')) - self.panels_f = [panel_f] * 20 - - def time_c_ordered(self, axis, ignore_index): - with warnings.catch_warnings(record=True): - concat(self.panels_c, axis=axis, ignore_index=ignore_index) - - def time_f_ordered(self, axis, ignore_index): - with warnings.catch_warnings(record=True): - concat(self.panels_f, axis=axis, ignore_index=ignore_index) - - class ConcatDataFrames(object): params = ([0, 1], [True, False]) diff --git a/asv_bench/benchmarks/panel_ctor.py b/asv_bench/benchmarks/panel_ctor.py deleted file mode 100644 index 627705284481b..0000000000000 --- a/asv_bench/benchmarks/panel_ctor.py +++ /dev/null @@ -1,55 +0,0 @@ -import warnings -from datetime import datetime, timedelta - -from pandas import DataFrame, Panel, date_range - - -class DifferentIndexes(object): - def setup(self): - self.data_frames = {} - start = datetime(1990, 1, 1) - end = datetime(2012, 1, 1) - for x in range(100): - end += timedelta(days=1) - idx = date_range(start, end) - df = DataFrame({'a': 0, 'b': 1, 'c': 2}, index=idx) - self.data_frames[x] = df - - def time_from_dict(self): - with warnings.catch_warnings(record=True): - Panel.from_dict(self.data_frames) - - -class SameIndexes(object): - - def setup(self): - idx = date_range(start=datetime(1990, 1, 1), - end=datetime(2012, 1, 1), - freq='D') - df = DataFrame({'a': 0, 'b': 1, 'c': 2}, index=idx) - self.data_frames = dict(enumerate([df] * 100)) - - def time_from_dict(self): - with warnings.catch_warnings(record=True): - Panel.from_dict(self.data_frames) - - -class TwoIndexes(object): - - def setup(self): - start = datetime(1990, 1, 1) - end = datetime(2012, 1, 1) - df1 = DataFrame({'a': 0, 'b': 1, 'c': 2}, - index=date_range(start=start, end=end, freq='D')) - end += timedelta(days=1) - df2 = DataFrame({'a': 0, 'b': 1, 'c': 2}, - index=date_range(start=start, end=end, freq='D')) - dfs = [df1] * 50 + [df2] * 50 - self.data_frames = dict(enumerate(dfs)) - - def time_from_dict(self): - with warnings.catch_warnings(record=True): - Panel.from_dict(self.data_frames) - - -from .pandas_vb_common import setup # noqa: F401 diff --git a/asv_bench/benchmarks/panel_methods.py b/asv_bench/benchmarks/panel_methods.py deleted file mode 100644 index a4c12c082236e..0000000000000 --- a/asv_bench/benchmarks/panel_methods.py +++ /dev/null @@ -1,25 +0,0 @@ -import warnings - -import numpy as np -from pandas import Panel - - -class PanelMethods(object): - - params = ['items', 'major', 'minor'] - param_names = ['axis'] - - def setup(self, axis): - with warnings.catch_warnings(record=True): - self.panel = Panel(np.random.randn(100, 1000, 100)) - - def time_pct_change(self, axis): - with warnings.catch_warnings(record=True): - self.panel.pct_change(1, axis=axis) - - def time_shift(self, axis): - with warnings.catch_warnings(record=True): - self.panel.shift(1, axis=axis) - - -from .pandas_vb_common import setup # noqa: F401 From 7b785e8bdd74c56d4c56e6a78cf47370b1dfc203 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Sun, 10 Mar 2019 21:31:33 -0700 Subject: [PATCH 2/4] Remove unused import --- asv_bench/benchmarks/join_merge.py | 1 - 1 file changed, 1 deletion(-) diff --git a/asv_bench/benchmarks/join_merge.py b/asv_bench/benchmarks/join_merge.py index d0a60bdff826a..baad8b61bfd19 100644 --- a/asv_bench/benchmarks/join_merge.py +++ b/asv_bench/benchmarks/join_merge.py @@ -1,4 +1,3 @@ -import warnings import string import numpy as np From 8e7670fb079bddc27516e9ce2a8f3fd2a5deea88 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Mon, 11 Mar 2019 17:50:46 -0700 Subject: [PATCH 3/4] Downgrade numpy for asv run --- azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f0567d76659b6..87ea22e03bc39 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -95,10 +95,11 @@ jobs: pytest --capture=no --strict scripts displayName: 'Testing docstring validaton script' condition: true - + # We downgrade numpy due to GH 24839 - script: | export PATH=$HOME/miniconda3/bin:$PATH source activate pandas-dev + conda install numpy==1.15.4 git remote add upstream https://github.com/pandas-dev/pandas.git git fetch upstream if git diff upstream/master --name-only | grep -q "^asv_bench/"; then From b4917f93cefe4a8395a693fa96969c8adf94ff5d Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Wed, 13 Mar 2019 22:42:30 -0700 Subject: [PATCH 4/4] No need to downgrade numpy --- azure-pipelines.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 87ea22e03bc39..f0567d76659b6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -95,11 +95,10 @@ jobs: pytest --capture=no --strict scripts displayName: 'Testing docstring validaton script' condition: true - # We downgrade numpy due to GH 24839 + - script: | export PATH=$HOME/miniconda3/bin:$PATH source activate pandas-dev - conda install numpy==1.15.4 git remote add upstream https://github.com/pandas-dev/pandas.git git fetch upstream if git diff upstream/master --name-only | grep -q "^asv_bench/"; then