Skip to content

Commit 2c45ed3

Browse files
committed
COMPAT: don't rely on dtype being False after numpy >= 1.13
closes pandas-dev#15199 Author: Jeff Reback <[email protected]> Closes pandas-dev#15200 from jreback/numpy-dev and squashes the following commits: 53d663e [Jeff Reback] BLD: pull wheel for numpy builds 5475db3 [Jeff Reback] COMPAT: numpy-dev compat on bool(dtype) change
1 parent b5cfaaa commit 2c45ed3

File tree

6 files changed

+34
-29
lines changed

6 files changed

+34
-29
lines changed

ci/install_travis.sh

+28-20
Original file line numberDiff line numberDiff line change
@@ -16,47 +16,48 @@
1616
function edit_init()
1717
{
1818
if [ -n "$LOCALE_OVERRIDE" ]; then
19-
echo "Adding locale to the first line of pandas/__init__.py"
19+
echo "[Adding locale to the first line of pandas/__init__.py]"
2020
rm -f pandas/__init__.pyc
2121
sedc="3iimport locale\nlocale.setlocale(locale.LC_ALL, '$LOCALE_OVERRIDE')\n"
2222
sed -i "$sedc" pandas/__init__.py
23-
echo "head -4 pandas/__init__.py"
23+
echo "[head -4 pandas/__init__.py]"
2424
head -4 pandas/__init__.py
2525
echo
2626
fi
2727
}
2828

29+
echo "[install_travis]"
2930
edit_init
3031

3132
home_dir=$(pwd)
32-
echo "home_dir: [$home_dir]"
33+
echo "[home_dir: $home_dir]"
3334

3435
MINICONDA_DIR="$HOME/miniconda3"
3536

3637
if [ -d "$MINICONDA_DIR" ] && [ -e "$MINICONDA_DIR/bin/conda" ] && [ "$USE_CACHE" ]; then
37-
echo "Miniconda install already present from cache: $MINICONDA_DIR"
38+
echo "[Miniconda install already present from cache: $MINICONDA_DIR]"
3839

3940
conda config --set always_yes yes --set changeps1 no || exit 1
40-
echo "update conda"
41+
echo "[update conda]"
4142
conda update -q conda || exit 1
4243

4344
# Useful for debugging any issues with conda
4445
conda info -a || exit 1
4546

4647
# set the compiler cache to work
4748
if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
48-
echo "Using ccache"
49+
echo "[Using ccache]"
4950
export PATH=/usr/lib/ccache:/usr/lib64/ccache:$PATH
5051
gcc=$(which gcc)
51-
echo "gcc: $gcc"
52+
echo "[gcc: $gcc]"
5253
ccache=$(which ccache)
53-
echo "ccache: $ccache"
54+
echo "[ccache: $ccache]"
5455
export CC='ccache gcc'
5556
fi
5657

5758
else
58-
echo "Using clean Miniconda install"
59-
echo "Not using ccache"
59+
echo "[Using clean Miniconda install]"
60+
echo "[Not using ccache]"
6061
rm -rf "$MINICONDA_DIR"
6162
# install miniconda
6263
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
@@ -66,14 +67,14 @@ else
6667
fi
6768
bash miniconda.sh -b -p "$MINICONDA_DIR" || exit 1
6869

69-
echo "update conda"
70+
echo "[update conda]"
7071
conda config --set ssl_verify false || exit 1
7172
conda config --set always_yes true --set changeps1 false || exit 1
7273
conda update -q conda
7374

7475
# add the pandas channel to take priority
7576
# to add extra packages
76-
echo "add channels"
77+
echo "[add channels]"
7778
conda config --add channels pandas || exit 1
7879
conda config --remove channels defaults || exit 1
7980
conda config --add channels defaults || exit 1
@@ -103,13 +104,19 @@ else
103104
fi
104105

105106
# build deps
107+
echo "[build installs]"
106108
REQ="ci/requirements-${PYTHON_VERSION}${JOB_TAG}.build"
107-
108-
# install deps
109109
if [ -e ${REQ} ]; then
110110
time conda install -n pandas --file=${REQ} || exit 1
111111
fi
112112

113+
# may have addtl installation instructions for this build
114+
echo "[build addtl installs]"
115+
REQ="ci/requirements-${PYTHON_VERSION}${JOB_TAG}.build.sh"
116+
if [ -e ${REQ} ]; then
117+
time bash $REQ || exit 1
118+
fi
119+
113120
source activate pandas
114121

115122
if [ "$BUILD_TEST" ]; then
@@ -122,39 +129,40 @@ if [ "$BUILD_TEST" ]; then
122129
else
123130

124131
# build but don't install
125-
echo "build em"
132+
echo "[build em]"
126133
time python setup.py build_ext --inplace || exit 1
127134

128135
# we may have run installations
129-
echo "conda installs"
136+
echo "[conda installs]"
130137
REQ="ci/requirements-${PYTHON_VERSION}${JOB_TAG}.run"
131138
if [ -e ${REQ} ]; then
132139
time conda install -n pandas --file=${REQ} || exit 1
133140
fi
134141

135142
# we may have additional pip installs
136-
echo "pip installs"
143+
echo "[pip installs]"
137144
REQ="ci/requirements-${PYTHON_VERSION}${JOB_TAG}.pip"
138145
if [ -e ${REQ} ]; then
139146
pip install --upgrade -r $REQ
140147
fi
141148

142149
# may have addtl installation instructions for this build
150+
echo "[addtl installs]"
143151
REQ="ci/requirements-${PYTHON_VERSION}${JOB_TAG}.sh"
144152
if [ -e ${REQ} ]; then
145153
time bash $REQ || exit 1
146154
fi
147155

148156
# remove any installed pandas package
149157
# w/o removing anything else
150-
echo "removing installed pandas"
158+
echo "[removing installed pandas]"
151159
conda remove pandas --force
152160

153161
# install our pandas
154-
echo "running setup.py develop"
162+
echo "[running setup.py develop]"
155163
python setup.py develop || exit 1
156164

157165
fi
158166

159-
echo "done"
167+
echo "[done]"
160168
exit 0

ci/requirements-3.5_NUMPY_DEV.sh renamed to ci/requirements-3.5_NUMPY_DEV.build.sh

-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ echo "install numpy master wheel"
77
# remove the system installed numpy
88
pip uninstall numpy -y
99

10-
# we need these for numpy
11-
12-
# these wheels don't play nice with the conda libgfortran / openblas
13-
# time conda install -n pandas libgfortran openblas || exit 1
14-
1510
# install numpy wheel from master
1611
pip install --pre --upgrade --no-index --timeout=60 --trusted-host travis-dev-wheels.scipy.org -f http://travis-dev-wheels.scipy.org/ numpy scipy
1712

pandas/compat/numpy/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
_np_version_under1p10 = _nlv < '1.10'
1515
_np_version_under1p11 = _nlv < '1.11'
1616
_np_version_under1p12 = _nlv < '1.12'
17+
_np_version_under1p13 = _nlv < '1.13'
1718

1819
if _nlv < '1.7.0':
1920
raise ImportError('this version of pandas is incompatible with '

pandas/core/ops.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -444,13 +444,15 @@ def _convert_to_array(self, values, name=None, other=None):
444444
supplied_dtype = None
445445
if not is_list_like(values):
446446
values = np.array([values])
447+
447448
# if this is a Series that contains relevant dtype info, then use this
448449
# instead of the inferred type; this avoids coercing Series([NaT],
449450
# dtype='datetime64[ns]') to Series([NaT], dtype='timedelta64[ns]')
450451
elif (isinstance(values, pd.Series) and
451452
(is_timedelta64_dtype(values) or is_datetime64_dtype(values))):
452453
supplied_dtype = values.dtype
453-
inferred_type = supplied_dtype or lib.infer_dtype(values)
454+
455+
inferred_type = lib.infer_dtype(values)
454456
if (inferred_type in ('datetime64', 'datetime', 'date', 'time') or
455457
is_datetimetz(inferred_type)):
456458
# if we have a other of timedelta, but use pd.NaT here we

pandas/tseries/index.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ def _simple_new(cls, values, name=None, freq=None, tz=None,
557557
if we are passed a non-dtype compat, then coerce using the constructor
558558
"""
559559

560-
if not getattr(values, 'dtype', None):
560+
if getattr(values, 'dtype', None) is None:
561561
# empty, but with dtype compat
562562
if values is None:
563563
values = np.empty(0, dtype=_NS_DTYPE)

pandas/tseries/tdi.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,7 @@ def _box_func(self):
272272

273273
@classmethod
274274
def _simple_new(cls, values, name=None, freq=None, **kwargs):
275-
if not getattr(values, 'dtype', None):
276-
values = np.array(values, copy=False)
275+
values = np.array(values, copy=False)
277276
if values.dtype == np.object_:
278277
values = tslib.array_to_timedelta64(values)
279278
if values.dtype != _TD_DTYPE:

0 commit comments

Comments
 (0)