Skip to content

Commit 4b5f4d1

Browse files
CI: Various fixups (#24092)
1 parent 1d3ed91 commit 4b5f4d1

File tree

9 files changed

+73
-38
lines changed

9 files changed

+73
-38
lines changed

asv_bench/benchmarks/algorithms.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import warnings
21
from importlib import import_module
32

43
import numpy as np
4+
55
import pandas as pd
66
from pandas.util import testing as tm
77

8+
89
for imp in ['pandas.util', 'pandas.tools.hashing']:
910
try:
1011
hashing = import_module(imp)
@@ -73,10 +74,6 @@ def setup(self):
7374
self.uniques = tm.makeStringIndex(1000).values
7475
self.all = self.uniques.repeat(10)
7576

76-
def time_match_string(self):
77-
with warnings.catch_warnings(record=True):
78-
pd.match(self.all, self.uniques)
79-
8077

8178
class Hashing(object):
8279

asv_bench/benchmarks/frame_methods.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import string
2-
import warnings
32

43
import numpy as np
4+
5+
from pandas import (
6+
DataFrame, MultiIndex, NaT, Series, date_range, isnull, period_range)
57
import pandas.util.testing as tm
6-
from pandas import (DataFrame, Series, MultiIndex, date_range, period_range,
7-
isnull, NaT)
88

99

1010
class GetNumericData(object):
@@ -61,9 +61,6 @@ def time_reindex_axis1(self):
6161
def time_reindex_both_axes(self):
6262
self.df.reindex(index=self.idx, columns=self.idx)
6363

64-
def time_reindex_both_axes_ix(self):
65-
self.df.ix[self.idx, self.idx]
66-
6764
def time_reindex_upcast(self):
6865
self.df2.reindex(np.random.permutation(range(1200)))
6966

asv_bench/benchmarks/groupby.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import warnings
2-
from string import ascii_letters
3-
from itertools import product
41
from functools import partial
2+
from itertools import product
3+
from string import ascii_letters
4+
import warnings
55

66
import numpy as np
7-
from pandas import (DataFrame, Series, MultiIndex, date_range, period_range,
8-
TimeGrouper, Categorical, Timestamp)
7+
8+
from pandas import (
9+
Categorical, DataFrame, MultiIndex, Series, TimeGrouper, Timestamp,
10+
date_range, period_range)
911
import pandas.util.testing as tm
1012

1113

@@ -210,7 +212,7 @@ def time_multi_int_nunique(self, df):
210212

211213
class AggFunctions(object):
212214

213-
def setup_cache():
215+
def setup_cache(self):
214216
N = 10**5
215217
fac1 = np.array(['A', 'B', 'C'], dtype='O')
216218
fac2 = np.array(['one', 'two'], dtype='O')

pandas/core/sparse/scipy_sparse.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,7 @@ def _get_label_to_i_dict(labels, sort_labels=False):
5858
return (d)
5959

6060
def _get_index_subset_to_coord_dict(index, subset, sort_labels=False):
61-
def robust_get_level_values(i):
62-
# if index has labels (that are not None) use those,
63-
# else use the level location
64-
try:
65-
return index.get_level_values(index.names[i])
66-
except KeyError:
67-
return index.get_level_values(i)
68-
69-
ilabels = list(zip(*[robust_get_level_values(i) for i in subset]))
61+
ilabels = list(zip(*[index._get_level_values(i) for i in subset]))
7062
labels_to_i = _get_label_to_i_dict(ilabels,
7163
sort_labels=sort_labels)
7264
labels_to_i = Series(labels_to_i)

pandas/io/formats/html.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from __future__ import print_function
77

8-
from distutils.version import LooseVersion
98
from textwrap import dedent
109

1110
from pandas.compat import OrderedDict, lzip, map, range, u, unichr, zip
@@ -161,15 +160,7 @@ def write_result(self, buf):
161160
_classes.extend(self.classes)
162161

163162
if self.notebook:
164-
div_style = ''
165-
try:
166-
import IPython
167-
if IPython.__version__ < LooseVersion('3.0.0'):
168-
div_style = ' style="max-width:1500px;overflow:auto;"'
169-
except (ImportError, AttributeError):
170-
pass
171-
172-
self.write('<div{style}>'.format(style=div_style))
163+
self.write('<div>')
173164

174165
self.write_style()
175166

pandas/tests/io/conftest.py

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ def s3_resource(tips_file, jsonl_file):
3737
"""
3838
pytest.importorskip('s3fs')
3939
boto3 = pytest.importorskip('boto3')
40+
# GH-24092. See if boto.plugin skips the test or fails.
41+
try:
42+
pytest.importorskip("boto.plugin")
43+
except AttributeError:
44+
raise pytest.skip("moto/moto error")
4045
moto = pytest.importorskip('moto')
4146

4247
test_s3_files = [

pandas/tests/io/json/test_pandas.py

+2
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,7 @@ def test_misc_example(self):
846846
assert_frame_equal(result, expected)
847847

848848
@network
849+
@pytest.mark.single
849850
def test_round_trip_exception_(self):
850851
# GH 3867
851852
csv = 'https://raw.github.com/hayd/lahman2012/master/csvs/Teams.csv'
@@ -856,6 +857,7 @@ def test_round_trip_exception_(self):
856857
index=df.index, columns=df.columns), df)
857858

858859
@network
860+
@pytest.mark.single
859861
def test_url(self):
860862
url = 'https://api.github.com/repos/pandas-dev/pandas/issues?per_page=5' # noqa
861863
result = read_json(url, convert_dates=True)

pandas/tests/sparse/frame/test_to_from_scipy.py

+14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
import numpy as np
3+
import pandas as pd
34
from pandas.util import testing as tm
45
from pandas import SparseDataFrame, SparseSeries
56
from pandas.core.sparse.api import SparseDtype
@@ -168,3 +169,16 @@ def test_from_scipy_fillna(spmatrix):
168169
expected[col].fill_value = -1
169170

170171
tm.assert_sp_frame_equal(sdf, expected)
172+
173+
174+
def test_index_names_multiple_nones():
175+
# https://github.com/pandas-dev/pandas/pull/24092
176+
sparse = pytest.importorskip("scipy.sparse")
177+
178+
s = (pd.Series(1, index=pd.MultiIndex.from_product([['A', 'B'], [0, 1]]))
179+
.to_sparse())
180+
result, _, _ = s.to_coo()
181+
assert isinstance(result, sparse.coo_matrix)
182+
result = result.toarray()
183+
expected = np.ones((2, 2), dtype="int64")
184+
tm.assert_numpy_array_equal(result, expected)

setup.cfg

+37-2
Original file line numberDiff line numberDiff line change
@@ -361,5 +361,40 @@ skip=
361361
pandas/tests/computation/test_compat.py,
362362
pandas/tests/computation/test_eval.py,
363363
pandas/types/common.py,
364-
pandas/tests/extension/arrow/test_bool.py
365-
doc/source/conf.py
364+
pandas/tests/extension/arrow/test_bool.py,
365+
doc/source/conf.py,
366+
asv_bench/benchmarks/algorithms.py,
367+
asv_bench/benchmarks/attrs_caching.py,
368+
asv_bench/benchmarks/binary_ops.py,
369+
asv_bench/benchmarks/categoricals.py,
370+
asv_bench/benchmarks/ctors.py,
371+
asv_bench/benchmarks/eval.py,
372+
asv_bench/benchmarks/frame_ctor.py,
373+
asv_bench/benchmarks/frame_methods.py,
374+
asv_bench/benchmarks/gil.py,
375+
asv_bench/benchmarks/groupby.py,
376+
asv_bench/benchmarks/index_object.py,
377+
asv_bench/benchmarks/indexing.py,
378+
asv_bench/benchmarks/inference.py,
379+
asv_bench/benchmarks/io/csv.py,
380+
asv_bench/benchmarks/io/excel.py,
381+
asv_bench/benchmarks/io/hdf.py,
382+
asv_bench/benchmarks/io/json.py,
383+
asv_bench/benchmarks/io/msgpack.py,
384+
asv_bench/benchmarks/io/pickle.py,
385+
asv_bench/benchmarks/io/sql.py,
386+
asv_bench/benchmarks/io/stata.py,
387+
asv_bench/benchmarks/join_merge.py,
388+
asv_bench/benchmarks/multiindex_object.py,
389+
asv_bench/benchmarks/panel_ctor.py,
390+
asv_bench/benchmarks/panel_methods.py,
391+
asv_bench/benchmarks/plotting.py,
392+
asv_bench/benchmarks/reindex.py,
393+
asv_bench/benchmarks/replace.py,
394+
asv_bench/benchmarks/reshape.py,
395+
asv_bench/benchmarks/rolling.py,
396+
asv_bench/benchmarks/series_methods.py,
397+
asv_bench/benchmarks/sparse.py,
398+
asv_bench/benchmarks/stat_ops.py,
399+
asv_bench/benchmarks/timeseries.py
400+

0 commit comments

Comments
 (0)