Skip to content

Commit 564230a

Browse files
committed
Merge remote-tracking branch 'upstream/master' into numpydev-object
2 parents 2721f6c + 21c93fc commit 564230a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+518
-488
lines changed

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717

18+
- name: Setting conda path
19+
run: echo "::add-path::${HOME}/miniconda3/bin"
20+
1821
- name: Checkout
1922
uses: actions/checkout@v1
2023

21-
- name: Setting conda path
22-
run: echo "::set-env name=PATH::${HOME}/miniconda3/bin:${PATH}"
23-
2424
- name: Looking for unwanted patterns
2525
run: ci/code_checks.sh patterns
2626
if: true

ci/deps/azure-36-locale.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ dependencies:
2727
- xlrd=1.1.0
2828
- xlsxwriter=0.9.8
2929
- xlwt=1.2.0
30+
# lowest supported version of pyarrow (putting it here instead of in
31+
# azure-36-minimum_versions because it needs numpy >= 1.14)
32+
- pyarrow=0.12
3033
- pip
3134
- pip:
3235
- html5lib==1.0b2

ci/deps/azure-37-locale.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: pandas-dev
22
channels:
3-
- defaults
43
- conda-forge
54
dependencies:
65
- python=3.7.*
@@ -33,3 +32,4 @@ dependencies:
3332
- xlrd
3433
- xlsxwriter
3534
- xlwt
35+
- pyarrow>=0.15

ci/deps/travis-36-cov.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ dependencies:
2727
- numexpr
2828
- numpy=1.15.*
2929
- odfpy
30-
- openpyxl
30+
- openpyxl<=3.0.1
31+
# https://github.com/pandas-dev/pandas/pull/30009 openpyxl 3.0.2 broke
3132
- pandas-gbq
3233
# https://github.com/pydata/pandas-gbq/issues/271
3334
- google-cloud-bigquery<=1.11
3435
- psycopg2
35-
# pyarrow segfaults on load: https://github.com/pandas-dev/pandas/issues/26716
36-
# - pyarrow=0.9.0
36+
- pyarrow>=0.12.0
3737
- pymysql
3838
- pytables
3939
- python-snappy

ci/print_skipped.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
def main(filename):
77
if not os.path.isfile(filename):
8-
return
8+
raise RuntimeError(f"Could not find junit file {filename!r}")
99

1010
tree = et.parse(filename)
1111
root = tree.getroot()
1212
current_class = ""
13-
for el in root.findall("testcase"):
13+
for el in root.iter("testcase"):
1414
cn = el.attrib["classname"]
1515
for sk in el.findall("skipped"):
1616
old_class = current_class
@@ -32,8 +32,7 @@ def main(filename):
3232
print("-" * 80)
3333
else:
3434
print(
35-
"#{i} {class_name}.{test_name}: {message}".format(
36-
**dict(test_data, i=i)
37-
)
35+
f"#{i} {test_data['class_name']}."
36+
f"{test_data['test_name']}: {test_data['message']}"
3837
)
3938
i += 1

doc/redirects.csv

-1
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,6 @@ generated/pandas.Series.pow,../reference/api/pandas.Series.pow
11191119
generated/pandas.Series.prod,../reference/api/pandas.Series.prod
11201120
generated/pandas.Series.product,../reference/api/pandas.Series.product
11211121
generated/pandas.Series.ptp,../reference/api/pandas.Series.ptp
1122-
generated/pandas.Series.put,../reference/api/pandas.Series.put
11231122
generated/pandas.Series.quantile,../reference/api/pandas.Series.quantile
11241123
generated/pandas.Series.radd,../reference/api/pandas.Series.radd
11251124
generated/pandas.Series.rank,../reference/api/pandas.Series.rank

doc/source/reference/series.rst

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Attributes
3939
Series.empty
4040
Series.dtypes
4141
Series.name
42-
Series.put
4342

4443
Conversion
4544
----------

doc/source/whatsnew/v1.0.0.rst

+4
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,9 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more.
565565
- Passing multiple axes to :meth:`DataFrame.dropna` is no longer supported (:issue:`20995`)
566566
- Removed previously deprecated :meth:`Series.nonzero`, use `to_numpy().nonzero()` instead (:issue:`24048`)
567567
- Passing floating dtype ``codes`` to :meth:`Categorical.from_codes` is no longer supported, pass ``codes.astype(np.int64)`` instead (:issue:`21775`)
568+
- :meth:`Series.str.partition` and :meth:`Series.str.rpartition` no longer accept "pat" keyword, use "sep" instead (:issue:`23767`)
569+
- Removed the previously deprecated :meth:`Series.put` (:issue:`27106`)
570+
- Removed the previously deprecated :attr:`Series.real`, :attr:`Series.imag` (:issue:`27106`)
568571
- Removed the previously deprecated :meth:`Series.to_dense`, :meth:`DataFrame.to_dense` (:issue:`26684`)
569572
- Removed the previously deprecated :meth:`Index.dtype_str`, use ``str(index.dtype)`` instead (:issue:`27106`)
570573
- :meth:`Categorical.ravel` returns a :class:`Categorical` instead of a ``ndarray`` (:issue:`27199`)
@@ -661,6 +664,7 @@ Numeric
661664
- Bug in :class:`UInt64Index` precision loss while constructing from a list with values in the ``np.uint64`` range (:issue:`29526`)
662665
- Bug in :class:`NumericIndex` construction that caused indexing to fail when integers in the ``np.uint64`` range were used (:issue:`28023`)
663666
- Bug in :class:`NumericIndex` construction that caused :class:`UInt64Index` to be casted to :class:`Float64Index` when integers in the ``np.uint64`` range were used to index a :class:`DataFrame` (:issue:`28279`)
667+
- Bug in :meth:`Series.interpolate` when using method=`index` with an unsorted index, would previously return incorrect results. (:issue:`21037`)
664668

665669
Conversion
666670
^^^^^^^^^^

doc/sphinxext/announce.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ def build_string(revision_range, heading="Contributors"):
113113
components["authors"] = "* " + "\n* ".join(components["authors"])
114114

115115
tpl = textwrap.dedent(
116-
"""\
117-
{heading}
118-
{uline}
116+
f"""\
117+
{components['heading']}
118+
{components['uline']}
119119
120-
{author_message}
121-
{authors}"""
122-
).format(**components)
120+
{components['author_message']}
121+
{components['authors']}"""
122+
)
123123
return tpl
124124

125125

doc/sphinxext/contributors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def run(self):
2727
except git.GitCommandError as exc:
2828
return [
2929
self.state.document.reporter.warning(
30-
"Cannot find contributors for range '{}': {}".format(range_, exc),
30+
f"Cannot find contributors for range {repr(range_)}: {exc}",
3131
line=self.lineno,
3232
)
3333
]

pandas/_libs/parsers.pyx

-5
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ from pandas.errors import (ParserError, DtypeWarning,
6363

6464
lzma = _import_lzma()
6565

66-
# Import CParserError as alias of ParserError for backwards compatibility.
67-
# Ultimately, we want to remove this import. See gh-12665 and gh-14479.
68-
CParserError = ParserError
69-
70-
7166
cdef:
7267
float64_t INF = <float64_t>np.inf
7368
float64_t NEGINF = -INF

pandas/compat/chainmap.py

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ def __setitem__(self, key, value):
1010
self.maps[0][key] = value
1111

1212
def __delitem__(self, key):
13+
"""
14+
Raises
15+
------
16+
KeyError
17+
If `key` doesn't exist.
18+
"""
1319
for mapping in self.maps:
1420
if key in mapping:
1521
del mapping[key]

pandas/core/base.py

+8-19
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ def __setattr__(self, key, value):
114114
or key in type(self).__dict__
115115
or getattr(self, key, None) is not None
116116
):
117-
raise AttributeError(
118-
"You cannot add any new attribute '{key}'".format(key=key)
119-
)
117+
raise AttributeError(f"You cannot add any new attribute '{key}'")
120118
object.__setattr__(self, key, value)
121119

122120

@@ -220,28 +218,22 @@ def _obj_with_exclusions(self):
220218

221219
def __getitem__(self, key):
222220
if self._selection is not None:
223-
raise IndexError(
224-
"Column(s) {selection} already selected".format(
225-
selection=self._selection
226-
)
227-
)
221+
raise IndexError(f"Column(s) {self._selection} already selected")
228222

229223
if isinstance(key, (list, tuple, ABCSeries, ABCIndexClass, np.ndarray)):
230224
if len(self.obj.columns.intersection(key)) != len(key):
231225
bad_keys = list(set(key).difference(self.obj.columns))
232-
raise KeyError(
233-
"Columns not found: {missing}".format(missing=str(bad_keys)[1:-1])
234-
)
226+
raise KeyError(f"Columns not found: {str(bad_keys)[1:-1]}")
235227
return self._gotitem(list(key), ndim=2)
236228

237229
elif not getattr(self, "as_index", False):
238230
if key not in self.obj.columns:
239-
raise KeyError("Column not found: {key}".format(key=key))
231+
raise KeyError(f"Column not found: {key}")
240232
return self._gotitem(key, ndim=2)
241233

242234
else:
243235
if key not in self.obj:
244-
raise KeyError("Column not found: {key}".format(key=key))
236+
raise KeyError(f"Column not found: {key}")
245237
return self._gotitem(key, ndim=1)
246238

247239
def _gotitem(self, key, ndim, subset=None):
@@ -293,8 +285,7 @@ def _try_aggregate_string_function(self, arg: str, *args, **kwargs):
293285
return f(self, *args, **kwargs)
294286

295287
raise AttributeError(
296-
"'{arg}' is not a valid function for "
297-
"'{cls}' object".format(arg=arg, cls=type(self).__name__)
288+
f"'{arg}' is not a valid function for '{type(self).__name__}' object"
298289
)
299290

300291
def _aggregate(self, arg, *args, **kwargs):
@@ -359,7 +350,7 @@ def _aggregate(self, arg, *args, **kwargs):
359350
elif isinstance(obj, ABCSeries):
360351
raise SpecificationError("nested renamer is not supported")
361352
elif isinstance(obj, ABCDataFrame) and k not in obj.columns:
362-
raise KeyError("Column '{col}' does not exist!".format(col=k))
353+
raise KeyError(f"Column '{k}' does not exist!")
363354

364355
arg = new_arg
365356

@@ -1101,9 +1092,7 @@ def _reduce(
11011092
func = getattr(self, name, None)
11021093
if func is None:
11031094
raise TypeError(
1104-
"{klass} cannot perform the operation {op}".format(
1105-
klass=type(self).__name__, op=name
1106-
)
1095+
f"{type(self).__name__} cannot perform the operation {name}"
11071096
)
11081097
return func(skipna=skipna, **kwds)
11091098

0 commit comments

Comments
 (0)