Skip to content

DOC: Style format #30054

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

Closed
wants to merge 3 commits into from
Closed
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
13 changes: 13 additions & 0 deletions asv_bench/benchmarks/index_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Float64Index,
Index,
IntervalIndex,
MultiIndex,
RangeIndex,
Series,
date_range,
Expand Down Expand Up @@ -111,6 +112,18 @@ def time_get_loc_dec(self):
self.idx_dec.get_loc(100000)


class IndexEquals:
def setup(self):
idx_large_fast = RangeIndex(100000)
idx_small_slow = date_range(start="1/1/2012", periods=1)
self.mi_large_slow = MultiIndex.from_product([idx_large_fast, idx_small_slow])

self.idx_non_object = RangeIndex(1)

def time_non_object_equals_multiindex(self):
self.idx_non_object.equals(self.mi_large_slow)


class IndexAppend:
def setup(self):

Expand Down
14 changes: 13 additions & 1 deletion asv_bench/benchmarks/multiindex_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import numpy as np

from pandas import DataFrame, MultiIndex, date_range
from pandas import DataFrame, MultiIndex, RangeIndex, date_range
import pandas.util.testing as tm


Expand Down Expand Up @@ -147,4 +147,16 @@ def time_categorical_level(self):
self.df.set_index(["a", "b"])


class Equals:
def setup(self):
idx_large_fast = RangeIndex(100000)
idx_small_slow = date_range(start="1/1/2012", periods=1)
self.mi_large_slow = MultiIndex.from_product([idx_large_fast, idx_small_slow])

self.idx_non_object = RangeIndex(1)

def time_equals_non_object_index(self):
self.mi_large_slow.equals(self.idx_non_object)


from .pandas_vb_common import setup # noqa: F401 isort:skip
80 changes: 28 additions & 52 deletions asv_bench/benchmarks/stat_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@

class FrameOps:

params = [ops, ["float", "int"], [0, 1], [True, False]]
param_names = ["op", "dtype", "axis", "use_bottleneck"]
params = [ops, ["float", "int"], [0, 1]]
param_names = ["op", "dtype", "axis"]

def setup(self, op, dtype, axis, use_bottleneck):
def setup(self, op, dtype, axis):
df = pd.DataFrame(np.random.randn(100000, 4)).astype(dtype)
try:
pd.options.compute.use_bottleneck = use_bottleneck
except TypeError:
from pandas.core import nanops

nanops._USE_BOTTLENECK = use_bottleneck
self.df_func = getattr(df, op)

def time_op(self, op, dtype, axis, use_bottleneck):
def time_op(self, op, dtype, axis):
self.df_func(axis=axis)


Expand All @@ -46,20 +40,14 @@ def time_op(self, level, op):

class SeriesOps:

params = [ops, ["float", "int"], [True, False]]
param_names = ["op", "dtype", "use_bottleneck"]
params = [ops, ["float", "int"]]
param_names = ["op", "dtype"]

def setup(self, op, dtype, use_bottleneck):
def setup(self, op, dtype):
s = pd.Series(np.random.randn(100000)).astype(dtype)
try:
pd.options.compute.use_bottleneck = use_bottleneck
except TypeError:
from pandas.core import nanops

nanops._USE_BOTTLENECK = use_bottleneck
self.s_func = getattr(s, op)

def time_op(self, op, dtype, use_bottleneck):
def time_op(self, op, dtype):
self.s_func()


Expand Down Expand Up @@ -101,61 +89,49 @@ def time_average_old(self, constructor, pct):

class Correlation:

params = [["spearman", "kendall", "pearson"], [True, False]]
param_names = ["method", "use_bottleneck"]
params = [["spearman", "kendall", "pearson"]]
param_names = ["method"]

def setup(self, method, use_bottleneck):
try:
pd.options.compute.use_bottleneck = use_bottleneck
except TypeError:
from pandas.core import nanops
def setup(self, method):
self.df = pd.DataFrame(np.random.randn(500, 15))
self.df2 = pd.DataFrame(np.random.randn(500, 15))
self.df_wide = pd.DataFrame(np.random.randn(500, 100))
self.df_wide_nans = self.df_wide.where(np.random.random((500, 100)) < 0.9)
self.s = pd.Series(np.random.randn(500))
self.s2 = pd.Series(np.random.randn(500))

nanops._USE_BOTTLENECK = use_bottleneck
self.df = pd.DataFrame(np.random.randn(1000, 30))
self.df2 = pd.DataFrame(np.random.randn(1000, 30))
self.df_wide = pd.DataFrame(np.random.randn(1000, 200))
self.df_wide_nans = self.df_wide.where(np.random.random((1000, 200)) < 0.9)
self.s = pd.Series(np.random.randn(1000))
self.s2 = pd.Series(np.random.randn(1000))

def time_corr(self, method, use_bottleneck):
def time_corr(self, method):
self.df.corr(method=method)

def time_corr_wide(self, method, use_bottleneck):
def time_corr_wide(self, method):
self.df_wide.corr(method=method)

def time_corr_wide_nans(self, method, use_bottleneck):
def time_corr_wide_nans(self, method):
self.df_wide_nans.corr(method=method)

def peakmem_corr_wide(self, method, use_bottleneck):
def peakmem_corr_wide(self, method):
self.df_wide.corr(method=method)

def time_corr_series(self, method, use_bottleneck):
def time_corr_series(self, method):
self.s.corr(self.s2, method=method)

def time_corrwith_cols(self, method, use_bottleneck):
def time_corrwith_cols(self, method):
self.df.corrwith(self.df2, method=method)

def time_corrwith_rows(self, method, use_bottleneck):
def time_corrwith_rows(self, method):
self.df.corrwith(self.df2, axis=1, method=method)


class Covariance:

params = [[True, False]]
param_names = ["use_bottleneck"]

def setup(self, use_bottleneck):
try:
pd.options.compute.use_bottleneck = use_bottleneck
except TypeError:
from pandas.core import nanops
params = []
param_names = []

nanops._USE_BOTTLENECK = use_bottleneck
def setup(self):
self.s = pd.Series(np.random.randn(100000))
self.s2 = pd.Series(np.random.randn(100000))

def time_cov_series(self, use_bottleneck):
def time_cov_series(self):
self.s.cov(self.s2)


Expand Down
6 changes: 3 additions & 3 deletions ci/azure/posix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:
CONDA_PY: "36"
PATTERN: "not slow and not network"
py36_locale_slow_old_np:
ENV_FILE: ci/deps/azure-36-locale.yaml
ENV_FILE: ci/deps/azure-36-locale_slow.yaml
CONDA_PY: "36"
PATTERN: "slow"
LOCALE_OVERRIDE: "zh_CN.UTF-8"
EXTRA_APT: "language-pack-zh-hans"

py36_locale_slow:
ENV_FILE: ci/deps/azure-36-locale_slow.yaml
py36_locale:
ENV_FILE: ci/deps/azure-36-locale.yaml
CONDA_PY: "36"
PATTERN: "not slow and not network"
LOCALE_OVERRIDE: "it_IT.UTF-8"
Expand Down
7 changes: 6 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then

# Imports - Check formatting using isort see setup.cfg for settings
MSG='Check import format using isort ' ; echo $MSG
isort --recursive --check-only pandas asv_bench
ISORT_CMD="isort --recursive --check-only pandas asv_bench"
if [[ "$GITHUB_ACTIONS" == "true" ]]; then
eval $ISORT_CMD | awk '{print "##[error]" $0}'; RET=$(($RET + ${PIPESTATUS[0]}))
else
eval $ISORT_CMD
fi
RET=$(($RET + $?)) ; echo $MSG "DONE"

fi
Expand Down
36 changes: 20 additions & 16 deletions ci/deps/azure-36-locale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,27 @@ dependencies:
- pytest-azurepipelines

# pandas dependencies
- beautifulsoup4==4.6.0
- bottleneck=1.2.*
- beautifulsoup4
- gcsfs
- html5lib
- ipython
- jinja2
- lxml
- matplotlib=2.2.2
- numpy=1.14.*
- openpyxl=2.4.8
- python-dateutil
- python-blosc
- pytz=2017.2
- scipy
- sqlalchemy=1.1.4
- xlrd=1.1.0
- xlsxwriter=0.9.8
- xlwt=1.2.0
- matplotlib=3.0.*
- nomkl
- numexpr
- numpy=1.15.*
- openpyxl
# lowest supported version of pyarrow (putting it here instead of in
# azure-36-minimum_versions because it needs numpy >= 1.14)
- pyarrow=0.12
- pip
- pip:
- html5lib==1.0b2
- pytables
- python-dateutil
- pytz
- s3fs
- scipy
- xarray
- xlrd
- xlsxwriter
- xlwt
- moto
32 changes: 14 additions & 18 deletions ci/deps/azure-36-locale_slow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,20 @@ dependencies:
- pytest-azurepipelines

# pandas dependencies
- beautifulsoup4
- gcsfs
- html5lib
- ipython
- jinja2
- beautifulsoup4==4.6.0
- bottleneck=1.2.*
- lxml
- matplotlib=3.0.*
- nomkl
- numexpr
- numpy=1.15.*
- openpyxl
- pytables
- matplotlib=2.2.2
- numpy=1.14.*
- openpyxl=2.4.8
- python-dateutil
- pytz
- s3fs
- python-blosc
- pytz=2017.2
- scipy
- xarray
- xlrd
- xlsxwriter
- xlwt
- moto
- sqlalchemy=1.1.4
- xlrd=1.1.0
- xlsxwriter=0.9.8
- xlwt=1.2.0
- pip
- pip:
- html5lib==1.0b2
2 changes: 1 addition & 1 deletion ci/print_skipped.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

def main(filename):
if not os.path.isfile(filename):
raise RuntimeError(f"Could not find junit file {filename!r}")
raise RuntimeError(f"Could not find junit file {repr(filename)}")

tree = et.parse(filename)
root = tree.getroot()
Expand Down
Loading