Skip to content

Commit 442eaf6

Browse files
committed
Merge remote-tracking branch 'upstream/master' into 32bit-ci
2 parents 6d6c1ec + 31788da commit 442eaf6

25 files changed

+93
-103
lines changed

.travis.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
language: python
22
python: 3.7
33

4+
addons:
5+
apt:
6+
update: true
7+
packages:
8+
- xvfb
9+
10+
services:
11+
- xvfb
12+
413
# To turn off cached cython files and compiler cache
514
# set NOCACHE-true
615
# To delete caches go to https://travis-ci.org/OWNER/REPOSITORY/caches or run
@@ -10,30 +19,27 @@ cache:
1019
ccache: true
1120
directories:
1221
- $HOME/.cache # cython cache
13-
- $HOME/.ccache # compiler cache
1422

1523
env:
1624
global:
17-
# Variable for test workers
1825
- PYTEST_WORKERS="auto"
1926
# create a github personal access token
2027
# cd pandas-dev/pandas
2128
# travis encrypt 'PANDAS_GH_TOKEN=personal_access_token' -r pandas-dev/pandas
2229
- secure: "EkWLZhbrp/mXJOx38CHjs7BnjXafsqHtwxPQrqWy457VDFWhIY1DMnIR/lOWG+a20Qv52sCsFtiZEmMfUjf0pLGXOqurdxbYBGJ7/ikFLk9yV2rDwiArUlVM9bWFnFxHvdz9zewBH55WurrY4ShZWyV+x2dWjjceWG5VpWeI6sA="
2330

2431
git:
25-
# for cloning
2632
depth: false
2733

2834
matrix:
2935
fast_finish: true
3036

3137
include:
32-
# In allowed failures
3338
- dist: bionic
3439
python: 3.9-dev
3540
env:
3641
- JOB="3.9-dev" PATTERN="(not slow and not network and not clipboard)"
42+
3743
- env:
3844
- JOB="3.8" ENV_FILE="ci/deps/travis-38.yaml" PATTERN="(not slow and not network and not clipboard)"
3945

@@ -42,7 +48,7 @@ matrix:
4248

4349
- arch: arm64
4450
env:
45-
- JOB="3.7, arm64" PYTEST_WORKERS=8 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard and not arm_slow)"
51+
- JOB="3.7, arm64" PYTEST_WORKERS=1 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard and not arm_slow)"
4652

4753
- env:
4854
- JOB="3.7, locale" ENV_FILE="ci/deps/travis-37-locale.yaml" PATTERN="((not slow and not network and not clipboard) or (single and db))" LOCALE_OVERRIDE="zh_CN.UTF-8" SQL="1"
@@ -71,12 +77,6 @@ before_install:
7177
- uname -a
7278
- git --version
7379
- ./ci/check_git_tags.sh
74-
# Because travis runs on Google Cloud and has a /etc/boto.cfg,
75-
# it breaks moto import, see:
76-
# https://github.com/spulec/moto/issues/1771
77-
# https://github.com/boto/boto/issues/3741
78-
# This overrides travis and tells it to look nowhere.
79-
- export BOTO_CONFIG=/dev/null
8080

8181
install:
8282
- echo "install start"

ci/build39.sh

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash -e
22
# Special build for python3.9 until numpy puts its own wheels up
33

4-
sudo apt-get install build-essential gcc xvfb
54
pip install --no-deps -U pip wheel setuptools
65
pip install cython numpy python-dateutil pytz pytest pytest-xdist hypothesis
76

ci/setup_env.sh

+1-11
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ else
4242
fi
4343

4444
if [ "${TRAVIS_CPU_ARCH}" == "arm64" ]; then
45-
sudo apt-get update
46-
sudo apt-get -y install xvfb
47-
CONDA_URL="https://github.com/conda-forge/miniforge/releases/download/4.8.5-0/Miniforge3-4.8.5-0-Linux-aarch64.sh"
45+
CONDA_URL="https://github.com/conda-forge/miniforge/releases/download/4.8.5-1/Miniforge3-4.8.5-1-Linux-aarch64.sh"
4846
else
4947
CONDA_URL="https://repo.continuum.io/miniconda/Miniconda3-latest-$CONDA_OS.sh"
5048
fi
@@ -100,8 +98,6 @@ echo "conda list (root environment)"
10098
conda list
10199

102100
# Clean up any left-over from a previous build
103-
# (note workaround for https://github.com/conda/conda/issues/2679:
104-
# `conda env remove` issue)
105101
conda remove --all -q -y -n pandas-dev
106102

107103
echo
@@ -142,12 +138,6 @@ conda list pandas
142138
echo "[Build extensions]"
143139
python setup.py build_ext -q -i -j2
144140

145-
# TODO: Some of our environments end up with old versions of pip (10.x)
146-
# Adding a new enough version of pip to the requirements explodes the
147-
# solve time. Just using pip to update itself.
148-
# - py35_macos
149-
# - py35_compat
150-
# - py36_32bit
151141
echo "[Updating pip]"
152142
python -m pip install --no-deps -U pip wheel setuptools
153143

doc/source/user_guide/timeseries.rst

+12
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,12 @@ This type of slicing will work on a ``DataFrame`` with a ``DatetimeIndex`` as we
579579
partial string selection is a form of label slicing, the endpoints **will be** included. This
580580
would include matching times on an included date:
581581

582+
.. warning::
583+
584+
Indexing ``DataFrame`` rows with strings is deprecated in pandas 1.2.0 and will be removed in a future version. Use ``frame.loc[dtstring]`` instead.
585+
582586
.. ipython:: python
587+
:okwarning:
583588
584589
dft = pd.DataFrame(np.random.randn(100000, 1), columns=['A'],
585590
index=pd.date_range('20130101', periods=100000, freq='T'))
@@ -590,24 +595,28 @@ This starts on the very first time in the month, and includes the last date and
590595
time for the month:
591596

592597
.. ipython:: python
598+
:okwarning:
593599
594600
dft['2013-1':'2013-2']
595601
596602
This specifies a stop time **that includes all of the times on the last day**:
597603

598604
.. ipython:: python
605+
:okwarning:
599606
600607
dft['2013-1':'2013-2-28']
601608
602609
This specifies an **exact** stop time (and is not the same as the above):
603610

604611
.. ipython:: python
612+
:okwarning:
605613
606614
dft['2013-1':'2013-2-28 00:00:00']
607615
608616
We are stopping on the included end-point as it is part of the index:
609617

610618
.. ipython:: python
619+
:okwarning:
611620
612621
dft['2013-1-15':'2013-1-15 12:30:00']
613622
@@ -631,6 +640,7 @@ We are stopping on the included end-point as it is part of the index:
631640
Slicing with string indexing also honors UTC offset.
632641

633642
.. ipython:: python
643+
:okwarning:
634644
635645
df = pd.DataFrame([0], index=pd.DatetimeIndex(['2019-01-01'], tz='US/Pacific'))
636646
df
@@ -681,6 +691,7 @@ If index resolution is second, then the minute-accurate timestamp gives a
681691
If the timestamp string is treated as a slice, it can be used to index ``DataFrame`` with ``[]`` as well.
682692

683693
.. ipython:: python
694+
:okwarning:
684695
685696
dft_minute = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]},
686697
index=series_minute.index)
@@ -2027,6 +2038,7 @@ You can pass in dates and strings to ``Series`` and ``DataFrame`` with ``PeriodI
20272038
Passing a string representing a lower frequency than ``PeriodIndex`` returns partial sliced data.
20282039

20292040
.. ipython:: python
2041+
:okwarning:
20302042
20312043
ps['2011']
20322044

doc/source/whatsnew/v0.11.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ Enhancements
367367
- You can now select with a string from a DataFrame with a datelike index, in a similar way to a Series (:issue:`3070`)
368368

369369
.. ipython:: python
370+
:okwarning:
370371
371372
idx = pd.date_range("2001-10-1", periods=5, freq='M')
372373
ts = pd.Series(np.random.rand(len(idx)), index=idx)

doc/source/whatsnew/v1.2.0.rst

+3
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ Deprecations
213213
- Date parser functions :func:`~pandas.io.date_converters.parse_date_time`, :func:`~pandas.io.date_converters.parse_date_fields`, :func:`~pandas.io.date_converters.parse_all_fields` and :func:`~pandas.io.date_converters.generic_parser` from ``pandas.io.date_converters`` are deprecated and will be removed in a future version; use :func:`to_datetime` instead (:issue:`35741`)
214214
- :meth:`DataFrame.lookup` is deprecated and will be removed in a future version, use :meth:`DataFrame.melt` and :meth:`DataFrame.loc` instead (:issue:`18682`)
215215
- The :meth:`Index.to_native_types` is deprecated. Use ``.astype(str)`` instead (:issue:`28867`)
216+
- Deprecated indexing :class:`DataFrame` rows with datetime-like strings ``df[string]``, use ``df.loc[string]`` instead (:issue:`36179`)
216217

217218
.. ---------------------------------------------------------------------------
218219
@@ -325,6 +326,7 @@ I/O
325326
- :meth:`to_picke` and :meth:`read_pickle` did not support compression for file-objects (:issue:`26237`, :issue:`29054`, and :issue:`29570`)
326327
- Bug in :func:`LongTableBuilder.middle_separator` was duplicating LaTeX longtable entires in the List of Tables of a LaTeX document (:issue:`34360`)
327328
- Bug in :meth:`read_csv` with `engine='python'` truncating data if multiple items present in first row and first element started with BOM (:issue:`36343`)
329+
- Removed ``private_key`` and ``verbose`` from :func:`read_gbq` as they are no longer supported in `pandas-gbq` (:issue:`34654` :issue:`30200`)
328330

329331
Plotting
330332
^^^^^^^^
@@ -372,6 +374,7 @@ ExtensionArray
372374

373375
Other
374376
^^^^^
377+
375378
- Bug in :meth:`DataFrame.replace` and :meth:`Series.replace` incorrectly raising ``AssertionError`` instead of ``ValueError`` when invalid parameter combinations are passed (:issue:`36045`)
376379
- Bug in :meth:`DataFrame.replace` and :meth:`Series.replace` with numeric values and string ``to_replace`` (:issue:`34789`)
377380
- Fixed metadata propagation in the :class:`Series.dt` accessor (:issue:`28283`)

pandas/core/arrays/_mixins.py

+8
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,11 @@ def fillna(self: _T, value=None, method=None, limit=None) -> _T:
227227
else:
228228
new_values = self.copy()
229229
return new_values
230+
231+
def _reduce(self, name: str, skipna: bool = True, **kwargs):
232+
meth = getattr(self, name, None)
233+
if meth:
234+
return meth(skipna=skipna, **kwargs)
235+
else:
236+
msg = f"'{type(self).__name__}' does not implement reduction '{name}'"
237+
raise TypeError(msg)

pandas/core/arrays/categorical.py

-6
Original file line numberDiff line numberDiff line change
@@ -1963,12 +1963,6 @@ def _reverse_indexer(self) -> Dict[Hashable, np.ndarray]:
19631963
# ------------------------------------------------------------------
19641964
# Reductions
19651965

1966-
def _reduce(self, name: str, skipna: bool = True, **kwargs):
1967-
func = getattr(self, name, None)
1968-
if func is None:
1969-
raise TypeError(f"Categorical cannot perform the operation {name}")
1970-
return func(skipna=skipna, **kwargs)
1971-
19721966
@deprecate_kwarg(old_arg_name="numeric_only", new_arg_name="skipna")
19731967
def min(self, skipna=True, **kwargs):
19741968
"""

pandas/core/arrays/datetimelike.py

-7
Original file line numberDiff line numberDiff line change
@@ -1453,13 +1453,6 @@ def __isub__(self, other):
14531453
# --------------------------------------------------------------
14541454
# Reductions
14551455

1456-
def _reduce(self, name: str, skipna: bool = True, **kwargs):
1457-
op = getattr(self, name, None)
1458-
if op:
1459-
return op(skipna=skipna, **kwargs)
1460-
else:
1461-
return super()._reduce(name, skipna, **kwargs)
1462-
14631456
def min(self, axis=None, skipna=True, *args, **kwargs):
14641457
"""
14651458
Return the minimum value of the Array or minimum along

pandas/core/arrays/datetimes.py

+8-23
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ def tz_to_dtype(tz):
7676

7777
def _field_accessor(name, field, docstring=None):
7878
def f(self):
79-
values = self.asi8
80-
if self.tz is not None and not timezones.is_utc(self.tz):
81-
values = self._local_timestamps()
79+
values = self._local_timestamps()
8280

8381
if field in self._bool_ops:
8482
if field.endswith(("start", "end")):
@@ -731,6 +729,8 @@ def _local_timestamps(self):
731729
This is used to calculate time-of-day information as if the timestamps
732730
were timezone-naive.
733731
"""
732+
if self.tz is None or timezones.is_utc(self.tz):
733+
return self.asi8
734734
return tzconversion.tz_convert_from_utc(self.asi8, self.tz)
735735

736736
def tz_convert(self, tz):
@@ -1167,10 +1167,7 @@ def month_name(self, locale=None):
11671167
>>> idx.month_name()
11681168
Index(['January', 'February', 'March'], dtype='object')
11691169
"""
1170-
if self.tz is not None and not timezones.is_utc(self.tz):
1171-
values = self._local_timestamps()
1172-
else:
1173-
values = self.asi8
1170+
values = self._local_timestamps()
11741171

11751172
result = fields.get_date_name_field(values, "month_name", locale=locale)
11761173
result = self._maybe_mask_results(result, fill_value=None)
@@ -1200,10 +1197,7 @@ def day_name(self, locale=None):
12001197
>>> idx.day_name()
12011198
Index(['Monday', 'Tuesday', 'Wednesday'], dtype='object')
12021199
"""
1203-
if self.tz is not None and not timezones.is_utc(self.tz):
1204-
values = self._local_timestamps()
1205-
else:
1206-
values = self.asi8
1200+
values = self._local_timestamps()
12071201

12081202
result = fields.get_date_name_field(values, "day_name", locale=locale)
12091203
result = self._maybe_mask_results(result, fill_value=None)
@@ -1217,10 +1211,7 @@ def time(self):
12171211
# If the Timestamps have a timezone that is not UTC,
12181212
# convert them into their i8 representation while
12191213
# keeping their timezone and not using UTC
1220-
if self.tz is not None and not timezones.is_utc(self.tz):
1221-
timestamps = self._local_timestamps()
1222-
else:
1223-
timestamps = self.asi8
1214+
timestamps = self._local_timestamps()
12241215

12251216
return ints_to_pydatetime(timestamps, box="time")
12261217

@@ -1241,10 +1232,7 @@ def date(self):
12411232
# If the Timestamps have a timezone that is not UTC,
12421233
# convert them into their i8 representation while
12431234
# keeping their timezone and not using UTC
1244-
if self.tz is not None and not timezones.is_utc(self.tz):
1245-
timestamps = self._local_timestamps()
1246-
else:
1247-
timestamps = self.asi8
1235+
timestamps = self._local_timestamps()
12481236

12491237
return ints_to_pydatetime(timestamps, box="date")
12501238

@@ -1283,10 +1271,7 @@ def isocalendar(self):
12831271
"""
12841272
from pandas import DataFrame
12851273

1286-
if self.tz is not None and not timezones.is_utc(self.tz):
1287-
values = self._local_timestamps()
1288-
else:
1289-
values = self.asi8
1274+
values = self._local_timestamps()
12901275
sarray = fields.build_isocalendar_sarray(values)
12911276
iso_calendar_df = DataFrame(
12921277
sarray, columns=["year", "week", "day"], dtype="UInt32"

pandas/core/arrays/numpy_.py

-8
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,6 @@ def _values_for_factorize(self) -> Tuple[np.ndarray, int]:
272272
# ------------------------------------------------------------------------
273273
# Reductions
274274

275-
def _reduce(self, name, skipna=True, **kwargs):
276-
meth = getattr(self, name, None)
277-
if meth:
278-
return meth(skipna=skipna, **kwargs)
279-
else:
280-
msg = f"'{type(self).__name__}' does not implement reduction '{name}'"
281-
raise TypeError(msg)
282-
283275
def any(self, axis=None, out=None, keepdims=False, skipna=True):
284276
nv.validate_any((), dict(out=out, keepdims=keepdims))
285277
return nanops.nanany(self._ndarray, axis=axis, skipna=skipna)

pandas/core/arrays/sparse/array.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def from_spmatrix(cls, data):
452452

453453
return cls._simple_new(arr, index, dtype)
454454

455-
def __array__(self, dtype=None, copy=True) -> np.ndarray:
455+
def __array__(self, dtype=None) -> np.ndarray:
456456
fill_value = self.fill_value
457457

458458
if self.sp_index.ngaps == 0:
@@ -1515,7 +1515,7 @@ def _formatter(self, boxed=False):
15151515
SparseArray._add_unary_ops()
15161516

15171517

1518-
def make_sparse(arr: np.ndarray, kind="block", fill_value=None, dtype=None, copy=False):
1518+
def make_sparse(arr: np.ndarray, kind="block", fill_value=None, dtype=None):
15191519
"""
15201520
Convert ndarray to sparse format
15211521

pandas/core/frame.py

+9
Original file line numberDiff line numberDiff line change
@@ -5891,14 +5891,23 @@ def _construct_result(self, result) -> DataFrame:
58915891
The resulting index will be a MultiIndex with 'self' and 'other'
58925892
stacked alternately at the inner level.
58935893
5894+
Raises
5895+
------
5896+
ValueError
5897+
When the two DataFrames don't have identical labels or shape.
5898+
58945899
See Also
58955900
--------
58965901
Series.compare : Compare with another Series and show differences.
5902+
DataFrame.equals : Test whether two objects contain the same elements.
58975903
58985904
Notes
58995905
-----
59005906
Matching NaNs will not appear as a difference.
59015907
5908+
Can only compare identically-labeled
5909+
(i.e. same shape, identical row and column labels) DataFrames
5910+
59025911
Examples
59035912
--------
59045913
>>> df = pd.DataFrame(

0 commit comments

Comments
 (0)