Skip to content

Commit 69bad56

Browse files
committed
DEP: bump min version of openpyxl to 3.0.0 pandas-dev#39603
1 parent 2ce801c commit 69bad56

File tree

6 files changed

+8
-11
lines changed

6 files changed

+8
-11
lines changed

ci/deps/azure-37-locale_slow.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
- lxml
1919
- matplotlib=3.0.0
2020
- numpy=1.16.*
21-
- openpyxl=2.6.0
21+
- openpyxl=3.0.0
2222
- python-dateutil
2323
- python-blosc
2424
- pytz=2017.3

ci/deps/azure-37-minimum_versions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919
- numba=0.46.0
2020
- numexpr=2.6.8
2121
- numpy=1.16.5
22-
- openpyxl=2.6.0
22+
- openpyxl=3.0.0
2323
- pytables=3.5.1
2424
- python-dateutil=2.7.3
2525
- pytz=2017.3

doc/source/getting_started/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ html5lib 1.0.1 HTML parser for read_html (see :ref
274274
lxml 4.3.0 HTML parser for read_html (see :ref:`note <optional_html>`)
275275
matplotlib 2.2.3 Visualization
276276
numba 0.46.0 Alternative execution engine for rolling operations
277-
openpyxl 2.6.0 Reading / writing for xlsx files
277+
openpyxl 3.0.0 Reading / writing for xlsx files
278278
pandas-gbq 0.12.0 Google Big Query access
279279
psycopg2 2.7 PostgreSQL engine for sqlalchemy
280280
pyarrow 0.15.0 Parquet, ORC, and feather reading / writing

doc/source/whatsnew/v1.3.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Optional libraries below the lowest tested version may still work, but are not c
186186
+-----------------+-----------------+---------+
187187
| numba | 0.46.0 | |
188188
+-----------------+-----------------+---------+
189-
| openpyxl | 2.6.0 | |
189+
| openpyxl | 3.0.0 | X |
190190
+-----------------+-----------------+---------+
191191
| pyarrow | 0.15.0 | |
192192
+-----------------+-----------------+---------+

pandas/compat/_optional.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"matplotlib": "2.2.3",
1818
"numexpr": "2.6.8",
1919
"odfpy": "1.3.0",
20-
"openpyxl": "2.6.0",
20+
"openpyxl": "3.0.0",
2121
"pandas_gbq": "0.12.0",
2222
"pyarrow": "0.15.0",
2323
"pytest": "5.0.1",

pandas/io/excel/_openpyxl.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
from __future__ import annotations
22

3-
from distutils.version import LooseVersion
43
import mmap
54
from typing import TYPE_CHECKING, Dict, List, Optional
65

76
import numpy as np
87

98
from pandas._typing import FilePathOrBuffer, Scalar, StorageOptions
10-
from pandas.compat._optional import get_version, import_optional_dependency
9+
from pandas.compat._optional import import_optional_dependency
1110

1211
from pandas.io.excel._base import BaseExcelReader, ExcelWriter
1312
from pandas.io.excel._util import validate_freeze_panes
@@ -536,13 +535,11 @@ def get_sheet_data(self, sheet, convert_float: bool) -> List[List[Scalar]]:
536535
# writers sometimes omit or get it wrong
537536
import openpyxl
538537

539-
version = LooseVersion(get_version(openpyxl))
540-
541538
# There is no good way of determining if a sheet is read-only
542539
# https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1605
543540
is_readonly = hasattr(sheet, "reset_dimensions")
544541

545-
if version >= "3.0.0" and is_readonly:
542+
if is_readonly:
546543
sheet.reset_dimensions()
547544

548545
data: List[List[Scalar]] = []
@@ -556,7 +553,7 @@ def get_sheet_data(self, sheet, convert_float: bool) -> List[List[Scalar]]:
556553
# Trim trailing empty rows
557554
data = data[: last_row_with_data + 1]
558555

559-
if version >= "3.0.0" and is_readonly and len(data) > 0:
556+
if is_readonly and len(data) > 0:
560557
# With dimension reset, openpyxl no longer pads rows
561558
max_width = max(len(data_row) for data_row in data)
562559
if min(len(data_row) for data_row in data) < max_width:

0 commit comments

Comments
 (0)