forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEPR: add shims for util + TST: test that we work in downstream packa…
…ges (pandas-dev#16250)
- Loading branch information
Showing
9 changed files
with
159 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
# this requires cython to be installed | ||
|
||
# this builds the release cleanly | ||
rm -rf dist | ||
git clean -xfd | ||
python setup.py clean | ||
python setup.py cython | ||
python setup.py sdist --formats=gztar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
xarray | ||
geopandas | ||
seaborn | ||
pandas_gbq | ||
pandas_datareader | ||
statsmodels | ||
scikit-learn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
source activate pandas | ||
|
||
echo "install 27 BUILD_TEST" | ||
|
||
conda install -n pandas -c conda-forge pyarrow dask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
""" | ||
Testing that we work in the downstream packages | ||
""" | ||
import pytest | ||
import numpy as np # noqa | ||
from pandas import DataFrame | ||
from pandas.util import testing as tm | ||
|
||
|
||
@pytest.fixture | ||
def df(): | ||
return DataFrame({'A': [1, 2, 3]}) | ||
|
||
|
||
def test_dask(df): | ||
|
||
toolz = pytest.importorskip('toolz') # noqa | ||
dask = pytest.importorskip('dask') # noqa | ||
|
||
import dask.dataframe as dd | ||
|
||
ddf = dd.from_pandas(df, npartitions=3) | ||
assert ddf.A is not None | ||
assert ddf.compute() is not None | ||
|
||
|
||
def test_xarray(df): | ||
|
||
xarray = pytest.importorskip('xarray') # noqa | ||
|
||
assert df.to_xarray() is not None | ||
|
||
|
||
def test_statsmodels(): | ||
|
||
statsmodels = pytest.importorskip('statsmodels') # noqa | ||
import statsmodels.api as sm | ||
import statsmodels.formula.api as smf | ||
df = sm.datasets.get_rdataset("Guerry", "HistData").data | ||
smf.ols('Lottery ~ Literacy + np.log(Pop1831)', data=df).fit() | ||
|
||
|
||
def test_scikit_learn(df): | ||
|
||
sklearn = pytest.importorskip('sklearn') # noqa | ||
from sklearn import svm, datasets | ||
|
||
digits = datasets.load_digits() | ||
clf = svm.SVC(gamma=0.001, C=100.) | ||
clf.fit(digits.data[:-1], digits.target[:-1]) | ||
clf.predict(digits.data[-1:]) | ||
|
||
|
||
def test_seaborn(): | ||
|
||
seaborn = pytest.importorskip('seaborn') | ||
tips = seaborn.load_dataset("tips") | ||
seaborn.stripplot(x="day", y="total_bill", data=tips) | ||
|
||
|
||
def test_pandas_gbq(df): | ||
|
||
pandas_gbq = pytest.importorskip('pandas-gbq') # noqa | ||
|
||
|
||
@tm.network | ||
def test_pandas_datareader(): | ||
|
||
pandas_datareader = pytest.importorskip('pandas-datareader') # noqa | ||
pandas_datareader.get_data_yahoo('AAPL') | ||
|
||
|
||
def test_geopandas(): | ||
|
||
geopandas = pytest.importorskip('geopandas') # noqa | ||
fp = geopandas.datasets.get_path('naturalearth_lowres') | ||
assert geopandas.read_file(fp) is not None | ||
|
||
|
||
def test_pyarrow(df): | ||
|
||
pyarrow = pytest.importorskip('pyarrow') # noqa | ||
table = pyarrow.Table.from_pandas(df) | ||
result = table.to_pandas() | ||
tm.assert_frame_equal(result, df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import warnings | ||
|
||
warnings.warn("pandas.types.common is deprecated and will be " | ||
"removed in a future version, import " | ||
"from pandas.api.types", | ||
DeprecationWarning, stacklevel=3) | ||
|
||
from pandas.core.dtypes.common import * # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import warnings | ||
|
||
warnings.warn("pandas.util.decorators is deprecated and will be " | ||
"removed in a future version, import " | ||
"from pandas.util", | ||
DeprecationWarning, stacklevel=3) | ||
|
||
from pandas.util._decorators import * # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import warnings | ||
import sys | ||
|
||
m = sys.modules['pandas.util.hashing'] | ||
for t in ['hash_pandas_object', 'hash_array']: | ||
|
||
def outer(t=t): | ||
|
||
def wrapper(*args, **kwargs): | ||
from pandas import util | ||
warnings.warn("pandas.util.hashing is deprecated and will be " | ||
"removed in a future version, import " | ||
"from pandas.util", | ||
DeprecationWarning, stacklevel=3) | ||
return getattr(util, t)(*args, **kwargs) | ||
return wrapper | ||
|
||
setattr(m, t, outer(t)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters