Skip to content

Commit 18efcb2

Browse files
datapythonistajreback
authored andcommitted
CI: Drop Python 3.5 support (#29212)
1 parent 9cf6269 commit 18efcb2

File tree

16 files changed

+36
-158
lines changed

16 files changed

+36
-158
lines changed

ci/azure/posix.yml

+6-7
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@ jobs:
99
strategy:
1010
matrix:
1111
${{ if eq(parameters.name, 'macOS') }}:
12-
py35_macos:
13-
ENV_FILE: ci/deps/azure-macos-35.yaml
14-
CONDA_PY: "35"
12+
py36_macos:
13+
ENV_FILE: ci/deps/azure-macos-36.yaml
14+
CONDA_PY: "36"
1515
PATTERN: "not slow and not network"
1616

1717
${{ if eq(parameters.name, 'Linux') }}:
18-
py35_compat:
19-
ENV_FILE: ci/deps/azure-35-compat.yaml
20-
CONDA_PY: "35"
18+
py36_minimum_versions:
19+
ENV_FILE: ci/deps/azure-36-minimum_versions.yaml
20+
CONDA_PY: "36"
2121
PATTERN: "not slow and not network"
22-
2322
py36_locale_slow_old_np:
2423
ENV_FILE: ci/deps/azure-36-locale.yaml
2524
CONDA_PY: "36"

ci/deps/azure-35-compat.yaml renamed to ci/deps/azure-36-minimum_versions.yaml

+4-7
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,23 @@ channels:
55
dependencies:
66
- beautifulsoup4=4.6.0
77
- bottleneck=1.2.1
8+
- cython>=0.29.13
89
- jinja2=2.8
910
- numexpr=2.6.2
1011
- numpy=1.13.3
1112
- openpyxl=2.4.8
1213
- pytables=3.4.2
1314
- python-dateutil=2.6.1
14-
- python=3.5.3
15+
- python=3.6.1
1516
- pytz=2017.2
1617
- scipy=0.19.0
1718
- xlrd=1.1.0
1819
- xlsxwriter=0.9.8
1920
- xlwt=1.2.0
2021
# universal
22+
- html5lib=1.0.1
2123
- hypothesis>=3.58.0
24+
- pytest=4.5.0
2225
- pytest-xdist
2326
- pytest-mock
2427
- pytest-azurepipelines
25-
- pip
26-
- pip:
27-
# for python 3.5, pytest>=4.0.2, cython>=0.29.13 is not available in conda
28-
- cython>=0.29.13
29-
- pytest==4.5.0
30-
- html5lib==1.0b2

ci/deps/azure-macos-35.yaml renamed to ci/deps/azure-macos-36.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
- openpyxl
1515
- pyarrow
1616
- pytables
17-
- python=3.5.*
17+
- python=3.6.*
1818
- python-dateutil==2.6.1
1919
- pytz
2020
- xarray

doc/source/development/contributing.rst

+2-25
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ Creating a Python environment (pip)
236236
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
237237

238238
If you aren't using conda for your development environment, follow these instructions.
239-
You'll need to have at least python3.5 installed on your system.
239+
You'll need to have at least Python 3.6.1 installed on your system.
240240

241241
**Unix**/**Mac OS**
242242

@@ -847,29 +847,6 @@ The limitation here is that while a human can reasonably understand that ``is_nu
847847
848848
With custom types and inference this is not always possible so exceptions are made, but every effort should be exhausted to avoid ``cast`` before going down such paths.
849849

850-
Syntax Requirements
851-
~~~~~~~~~~~~~~~~~~~
852-
853-
Because *pandas* still supports Python 3.5, :pep:`526` does not apply and variables **must** be annotated with type comments. Specifically, this is a valid annotation within pandas:
854-
855-
.. code-block:: python
856-
857-
primes = [] # type: List[int]
858-
859-
Whereas this is **NOT** allowed:
860-
861-
.. code-block:: python
862-
863-
primes: List[int] = [] # not supported in Python 3.5!
864-
865-
Note that function signatures can always be annotated per :pep:`3107`:
866-
867-
.. code-block:: python
868-
869-
def sum_of_primes(primes: List[int] = []) -> int:
870-
...
871-
872-
873850
Pandas-specific Types
874851
~~~~~~~~~~~~~~~~~~~~~
875852

@@ -1296,7 +1273,7 @@ environment by::
12961273

12971274
or, to use a specific Python interpreter,::
12981275

1299-
asv run -e -E existing:python3.5
1276+
asv run -e -E existing:python3.6
13001277

13011278
This will display stderr from the benchmarks, and use your local
13021279
``python`` that comes from your ``$PATH``.

doc/source/development/policies.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Pandas may change the behavior of experimental features at any time.
5151
Python Support
5252
~~~~~~~~~~~~~~
5353

54-
Pandas will only drop support for specific Python versions (e.g. 3.5.x, 3.6.x) in
54+
Pandas will only drop support for specific Python versions (e.g. 3.6.x, 3.7.x) in
5555
pandas **major** releases.
5656

5757
.. _SemVer: https://semver.org

doc/source/getting_started/dsintro.rst

-47
Original file line numberDiff line numberDiff line change
@@ -564,53 +564,6 @@ to a column created earlier in the same :meth:`~DataFrame.assign`.
564564
In the second expression, ``x['C']`` will refer to the newly created column,
565565
that's equal to ``dfa['A'] + dfa['B']``.
566566

567-
To write code compatible with all versions of Python, split the assignment in two.
568-
569-
.. ipython:: python
570-
571-
dependent = pd.DataFrame({"A": [1, 1, 1]})
572-
(dependent.assign(A=lambda x: x['A'] + 1)
573-
.assign(B=lambda x: x['A'] + 2))
574-
575-
.. warning::
576-
577-
Dependent assignment may subtly change the behavior of your code between
578-
Python 3.6 and older versions of Python.
579-
580-
If you wish to write code that supports versions of python before and after 3.6,
581-
you'll need to take care when passing ``assign`` expressions that
582-
583-
* Update an existing column
584-
* Refer to the newly updated column in the same ``assign``
585-
586-
For example, we'll update column "A" and then refer to it when creating "B".
587-
588-
.. code-block:: python
589-
590-
>>> dependent = pd.DataFrame({"A": [1, 1, 1]})
591-
>>> dependent.assign(A=lambda x: x["A"] + 1, B=lambda x: x["A"] + 2)
592-
593-
For Python 3.5 and earlier the expression creating ``B`` refers to the
594-
"old" value of ``A``, ``[1, 1, 1]``. The output is then
595-
596-
.. code-block:: console
597-
598-
A B
599-
0 2 3
600-
1 2 3
601-
2 2 3
602-
603-
For Python 3.6 and later, the expression creating ``A`` refers to the
604-
"new" value of ``A``, ``[2, 2, 2]``, which results in
605-
606-
.. code-block:: console
607-
608-
A B
609-
0 2 4
610-
1 2 4
611-
2 2 4
612-
613-
614567

615568
Indexing / selection
616569
~~~~~~~~~~~~~~~~~~~~

doc/source/getting_started/install.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Instructions for installing from source,
1818
Python version support
1919
----------------------
2020

21-
Officially Python 3.5.3 and above, 3.6, 3.7, and 3.8.
21+
Officially Python 3.6.1 and above, 3.7, and 3.8.
2222

2323
Installing pandas
2424
-----------------
@@ -140,7 +140,7 @@ Installing with ActivePython
140140
Installation instructions for
141141
`ActivePython <https://www.activestate.com/activepython>`__ can be found
142142
`here <https://www.activestate.com/activepython/downloads>`__. Versions
143-
2.7 and 3.5 include pandas.
143+
2.7, 3.5 and 3.6 include pandas.
144144

145145
Installing using your Linux distribution's package manager.
146146
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

doc/source/whatsnew/v1.0.0.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
What's new in 1.0.0 (??)
44
------------------------
55

6+
.. warning::
7+
8+
Starting with the 1.x series of releases, pandas only supports Python 3.6.1 and higher.
9+
610
New Deprecation Policy
711
~~~~~~~~~~~~~~~~~~~~~~
812

@@ -37,10 +41,6 @@ See :ref:`policies.version` for more.
3741
.. _2019 Pandas User Survey: http://dev.pandas.io/pandas-blog/2019-pandas-user-survey.html
3842
.. _SemVer: https://semver.org
3943

40-
.. warning::
41-
42-
The minimum supported Python version will be bumped to 3.6 in a future release.
43-
4444
{{ header }}
4545

4646
These are the changes in pandas 1.0.0. See :ref:`release` for a full changelog

pandas/compat/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import sys
1313
import warnings
1414

15-
PY35 = sys.version_info[:2] == (3, 5)
1615
PY36 = sys.version_info >= (3, 6)
1716
PY37 = sys.version_info >= (3, 7)
1817
PY38 = sys.version_info >= (3, 8)

pandas/io/json/_json.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from pandas.core.dtypes.common import ensure_str, is_period_dtype
1414

15-
from pandas import DataFrame, MultiIndex, Series, compat, isna, to_datetime
15+
from pandas import DataFrame, MultiIndex, Series, isna, to_datetime
1616
from pandas._typing import JSONSerializable
1717
from pandas.core.reshape.concat import concat
1818

@@ -1115,8 +1115,6 @@ def _parse_no_numpy(self):
11151115
dtype=None,
11161116
orient="index",
11171117
)
1118-
if compat.PY35:
1119-
self.obj = self.obj.sort_index(axis="columns").sort_index(axis="index")
11201118
elif orient == "table":
11211119
self.obj = parse_table_schema(json, precise_float=self.precise_float)
11221120
else:

pandas/tests/groupby/aggregate/test_aggregate.py

-12
Original file line numberDiff line numberDiff line change
@@ -598,10 +598,7 @@ def test_agg_with_one_lambda(self):
598598
}
599599
)
600600

601-
# sort for 35 and earlier
602601
columns = ["height_sqr_min", "height_max", "weight_max"]
603-
if compat.PY35:
604-
columns = ["height_max", "height_sqr_min", "weight_max"]
605602
expected = pd.DataFrame(
606603
{
607604
"height_sqr_min": [82.81, 36.00],
@@ -640,22 +637,13 @@ def test_agg_multiple_lambda(self):
640637
"weight": [7.9, 7.5, 9.9, 198.0],
641638
}
642639
)
643-
# sort for 35 and earlier
644640
columns = [
645641
"height_sqr_min",
646642
"height_max",
647643
"weight_max",
648644
"height_max_2",
649645
"weight_min",
650646
]
651-
if compat.PY35:
652-
columns = [
653-
"height_max",
654-
"height_max_2",
655-
"height_sqr_min",
656-
"weight_max",
657-
"weight_min",
658-
]
659647
expected = pd.DataFrame(
660648
{
661649
"height_sqr_min": [82.81, 36.00],

pandas/tests/io/json/test_json_table_schema.py

+6-16
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import numpy as np
66
import pytest
77

8-
from pandas.compat import PY35
9-
108
from pandas.core.dtypes.dtypes import CategoricalDtype, DatetimeTZDtype, PeriodDtype
119

1210
import pandas as pd
@@ -22,14 +20,6 @@
2220
)
2321

2422

25-
def assert_results_equal(result, expected):
26-
"""Helper function for comparing deserialized JSON with Py35 compat."""
27-
if PY35:
28-
assert sorted(result.items()) == sorted(expected.items())
29-
else:
30-
assert result == expected
31-
32-
3323
class TestBuildSchema:
3424
def setup_method(self, method):
3525
self.df = DataFrame(
@@ -245,7 +235,7 @@ def test_build_series(self):
245235
]
246236
)
247237

248-
assert_results_equal(result, expected)
238+
assert result == expected
249239

250240
def test_to_json(self):
251241
df = self.df.copy()
@@ -335,7 +325,7 @@ def test_to_json(self):
335325
]
336326
expected = OrderedDict([("schema", schema), ("data", data)])
337327

338-
assert_results_equal(result, expected)
328+
assert result == expected
339329

340330
def test_to_json_float_index(self):
341331
data = pd.Series(1, index=[1.0, 2.0])
@@ -365,7 +355,7 @@ def test_to_json_float_index(self):
365355
]
366356
)
367357

368-
assert_results_equal(result, expected)
358+
assert result == expected
369359

370360
def test_to_json_period_index(self):
371361
idx = pd.period_range("2016", freq="Q-JAN", periods=2)
@@ -386,7 +376,7 @@ def test_to_json_period_index(self):
386376
]
387377
expected = OrderedDict([("schema", schema), ("data", data)])
388378

389-
assert_results_equal(result, expected)
379+
assert result == expected
390380

391381
def test_to_json_categorical_index(self):
392382
data = pd.Series(1, pd.CategoricalIndex(["a", "b"]))
@@ -421,7 +411,7 @@ def test_to_json_categorical_index(self):
421411
]
422412
)
423413

424-
assert_results_equal(result, expected)
414+
assert result == expected
425415

426416
def test_date_format_raises(self):
427417
with pytest.raises(ValueError):
@@ -558,7 +548,7 @@ def test_categorical(self):
558548
]
559549
)
560550

561-
assert_results_equal(result, expected)
551+
assert result == expected
562552

563553
@pytest.mark.parametrize(
564554
"idx,nm,prop",

0 commit comments

Comments
 (0)