Skip to content

Commit 74a3e70

Browse files
authored
Merge pull request pandas-dev#8 from dimastbk/issue-50395
2 parents f5ab40d + 02c2e7f commit 74a3e70

File tree

10 files changed

+53
-57
lines changed

10 files changed

+53
-57
lines changed

ci/deps/actions-311.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ dependencies:
5555
- zstandard>=0.15.2
5656

5757
- pip:
58-
- python-calamine>=0.1.0
58+
- python-calamine>=0.1.1
5959
- tzdata>=2022.1

ci/deps/actions-38-minimum_versions.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ dependencies:
5959

6060
- pip:
6161
- pyqt5==5.15.1
62-
- python-calamine==0.1.0
62+
- python-calamine==0.1.1
6363
- tzdata==2022.1

doc/source/getting_started/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ xlrd 2.0.1 excel Reading Excel
345345
xlsxwriter 1.4.3 excel Writing Excel
346346
openpyxl 3.0.7 excel Reading / writing for xlsx files
347347
pyxlsb 1.0.8 excel Reading for xlsb files
348-
python-calamine 0.1.0 excel Reading for xls/xlsx/xlsb/ods files
348+
python-calamine 0.1.1 excel Reading for xls/xlsx/xlsb/ods files
349349
========================= ================== =============== =============================================================
350350

351351
HTML

doc/source/user_guide/io.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -3421,7 +3421,8 @@ The :func:`~pandas.read_excel` method can read Excel 2007+ (``.xlsx``) files
34213421
using the ``openpyxl`` Python module. Excel 2003 (``.xls``) files
34223422
can be read using ``xlrd``. Binary Excel (``.xlsb``)
34233423
files can be read using ``pyxlsb``. Also, all this formats can be read using ``python-calamine``,
3424-
but this library has sime limitation, for example, can't detect date in most formats.
3424+
but this library has some limitation and different behavior from other libraries,
3425+
for example, can't detect date in some formats (xls and xlsb).
34253426
The :meth:`~DataFrame.to_excel` instance method is used for
34263427
saving a ``DataFrame`` to Excel. Generally the semantics are
34273428
similar to working with :ref:`csv<io.read_csv_table>` data.

pandas/compat/_optional.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"pyarrow": "7.0.0",
3838
"pyreadstat": "1.1.2",
3939
"pytest": "7.0.0",
40-
"python-calamine": "0.1.0",
40+
"python-calamine": "0.1.1",
4141
"pyxlsb": "1.0.8",
4242
"s3fs": "2021.08.0",
4343
"scipy": "1.7.1",

pandas/tests/io/excel/test_readers.py

+41-46
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ def test_usecols_list(self, request, engine, read_ext, df_ref):
174174
reason="Sheets containing datetimes not supported by pyxlsb"
175175
)
176176
)
177-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
177+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
178178
request.node.add_marker(
179179
pytest.mark.xfail(
180-
reason="Calamine support parsing datetime only in xlsx"
180+
reason="Calamine support parsing datetime only in xlsx/ods"
181181
)
182182
)
183183

@@ -204,10 +204,10 @@ def test_usecols_str(self, request, engine, read_ext, df_ref):
204204
reason="Sheets containing datetimes not supported by pyxlsb"
205205
)
206206
)
207-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
207+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
208208
request.node.add_marker(
209209
pytest.mark.xfail(
210-
reason="Calamine support parsing datetime only in xlsx"
210+
reason="Calamine support parsing datetime only in xlsx/ods"
211211
)
212212
)
213213

@@ -268,10 +268,10 @@ def test_usecols_diff_positional_int_columns_order(
268268
reason="Sheets containing datetimes not supported by pyxlsb"
269269
)
270270
)
271-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
271+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
272272
request.node.add_marker(
273273
pytest.mark.xfail(
274-
reason="Calamine support parsing datetime only in xlsx"
274+
reason="Calamine support parsing datetime only in xlsx/ods"
275275
)
276276
)
277277

@@ -296,10 +296,10 @@ def test_read_excel_without_slicing(self, request, engine, read_ext, df_ref):
296296
reason="Sheets containing datetimes not supported by pyxlsb"
297297
)
298298
)
299-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
299+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
300300
request.node.add_marker(
301301
pytest.mark.xfail(
302-
reason="Calamine support parsing datetime only in xlsx"
302+
reason="Calamine support parsing datetime only in xlsx/ods"
303303
)
304304
)
305305

@@ -314,10 +314,10 @@ def test_usecols_excel_range_str(self, request, engine, read_ext, df_ref):
314314
reason="Sheets containing datetimes not supported by pyxlsb"
315315
)
316316
)
317-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
317+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
318318
request.node.add_marker(
319319
pytest.mark.xfail(
320-
reason="Calamine support parsing datetime only in xlsx"
320+
reason="Calamine support parsing datetime only in xlsx/ods"
321321
)
322322
)
323323

@@ -400,11 +400,9 @@ def test_excel_cell_error_na(self, request, engine, read_ext):
400400
reason="Sheets containing datetimes not supported by pyxlsb"
401401
)
402402
)
403-
if engine == "calamine" and read_ext in {".ods"}:
403+
if engine == "calamine" and read_ext == ".ods":
404404
request.node.add_marker(
405-
pytest.mark.xfail(
406-
reason="Calamine support parsing datetime only in xlsx"
407-
)
405+
pytest.mark.xfail(reason="Calamine returns 0 instead of NaN in ods")
408406
)
409407

410408
parsed = pd.read_excel("test3" + read_ext, sheet_name="Sheet1")
@@ -418,10 +416,10 @@ def test_excel_table(self, request, engine, read_ext, df_ref):
418416
reason="Sheets containing datetimes not supported by pyxlsb"
419417
)
420418
)
421-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
419+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
422420
request.node.add_marker(
423421
pytest.mark.xfail(
424-
reason="Calamine support parsing datetime only in xlsx"
422+
reason="Calamine support parsing datetime only in xlsx/ods"
425423
)
426424
)
427425

@@ -445,15 +443,15 @@ def test_reader_special_dtypes(self, request, engine, read_ext):
445443
reason="Sheets containing datetimes not supported by pyxlsb"
446444
)
447445
)
448-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
446+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
449447
request.node.add_marker(
450448
pytest.mark.xfail(
451-
reason="Calamine support parsing datetime only in xlsx"
449+
reason="Calamine support parsing datetime only in xlsx/ods"
452450
)
453451
)
454-
if engine == "calamine":
452+
if engine == "calamine" and read_ext != ".ods":
455453
request.node.add_marker(
456-
pytest.mark.xfail(reason="Calamine can't parse this datetime format")
454+
pytest.mark.xfail(reason="Maybe not supported by calamine")
457455
)
458456

459457
expected = DataFrame.from_dict(
@@ -715,13 +713,6 @@ def test_dtype_mangle_dup_cols(self, read_ext, dtypes, exp_value):
715713

716714
def test_reader_spaces(self, request, engine, read_ext):
717715
# see gh-32207
718-
719-
# https://github.com/tafia/calamine/pull/289
720-
if engine == "calamine" and read_ext == ".ods":
721-
request.node.add_marker(
722-
pytest.mark.xfail(reason="Calamine doesn't respect spaces in ods")
723-
)
724-
725716
basename = "test_spaces"
726717

727718
actual = pd.read_excel(basename + read_ext)
@@ -826,7 +817,7 @@ def test_date_conversion_overflow(self, request, engine, read_ext):
826817
columns=["DateColWithBigInt", "StringCol"],
827818
)
828819

829-
if engine == "calamine":
820+
if engine == "calamine" and read_ext != ".ods":
830821
request.node.add_marker(
831822
pytest.mark.xfail(reason="Maybe not supported by calamine")
832823
)
@@ -852,10 +843,10 @@ def test_sheet_name(self, request, read_ext, engine, df_ref):
852843
reason="Sheets containing datetimes not supported by pyxlsb"
853844
)
854845
)
855-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
846+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
856847
request.node.add_marker(
857848
pytest.mark.xfail(
858-
reason="Calamine support parsing datetime only in xlsx"
849+
reason="Calamine support parsing datetime only in xlsx/ods"
859850
)
860851
)
861852

@@ -1027,10 +1018,10 @@ def test_reader_seconds(self, request, engine, read_ext):
10271018
reason="Sheets containing datetimes not supported by pyxlsb"
10281019
)
10291020
)
1030-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
1021+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
10311022
request.node.add_marker(
10321023
pytest.mark.xfail(
1033-
reason="Calamine support parsing datetime only in xlsx"
1024+
reason="Calamine support parsing datetime only in xlsx/ods"
10341025
)
10351026
)
10361027
if engine == "calamine":
@@ -1073,12 +1064,16 @@ def test_read_excel_multiindex(self, request, engine, read_ext):
10731064
reason="Sheets containing datetimes not supported by pyxlsb"
10741065
)
10751066
)
1076-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
1067+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
10771068
request.node.add_marker(
10781069
pytest.mark.xfail(
1079-
reason="Calamine support parsing datetime only in xlsx"
1070+
reason="Calamine support parsing datetime only in xlsx/ods"
10801071
)
10811072
)
1073+
if engine == "calamine" and read_ext == ".ods":
1074+
request.node.add_marker(
1075+
pytest.mark.xfail(reason="Last test fails in calamine")
1076+
)
10821077

10831078
mi = MultiIndex.from_product([["foo", "bar"], ["a", "b"]])
10841079
mi_file = "testmultiindex" + read_ext
@@ -1175,10 +1170,10 @@ def test_read_excel_multiindex_blank_after_name(
11751170
f"not supported by {engine} (GH4679)"
11761171
)
11771172
)
1178-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
1173+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
11791174
request.node.add_marker(
11801175
pytest.mark.xfail(
1181-
reason="Calamine support parsing datetime only in xlsx"
1176+
reason="Calamine support parsing datetime only in xlsx/ods"
11821177
)
11831178
)
11841179

@@ -1310,10 +1305,10 @@ def test_read_excel_skiprows(self, request, engine, read_ext):
13101305
reason="Sheets containing datetimes not supported by pyxlsb"
13111306
)
13121307
)
1313-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
1308+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
13141309
request.node.add_marker(
13151310
pytest.mark.xfail(
1316-
reason="Calamine support parsing datetime only in xlsx"
1311+
reason="Calamine support parsing datetime only in xlsx/ods"
13171312
)
13181313
)
13191314

@@ -1371,10 +1366,10 @@ def test_read_excel_skiprows_callable_not_in(self, request, engine, read_ext):
13711366
reason="Sheets containing datetimes not supported by pyxlsb"
13721367
)
13731368
)
1374-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
1369+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
13751370
request.node.add_marker(
13761371
pytest.mark.xfail(
1377-
reason="Calamine support parsing datetime only in xlsx"
1372+
reason="Calamine support parsing datetime only in xlsx/ods"
13781373
)
13791374
)
13801375

@@ -1651,10 +1646,10 @@ def test_excel_table_sheet_by_index(self, request, engine, read_ext, df_ref):
16511646
reason="Sheets containing datetimes not supported by pyxlsb"
16521647
)
16531648
)
1654-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
1649+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
16551650
request.node.add_marker(
16561651
pytest.mark.xfail(
1657-
reason="Calamine support parsing datetime only in xlsx"
1652+
reason="Calamine support parsing datetime only in xlsx/ods"
16581653
)
16591654
)
16601655

@@ -1686,10 +1681,10 @@ def test_sheet_name(self, request, engine, read_ext, df_ref):
16861681
reason="Sheets containing datetimes not supported by pyxlsb"
16871682
)
16881683
)
1689-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
1684+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
16901685
request.node.add_marker(
16911686
pytest.mark.xfail(
1692-
reason="Calamine support parsing datetime only in xlsx"
1687+
reason="Calamine support parsing datetime only in xlsx/ods"
16931688
)
16941689
)
16951690

@@ -1784,10 +1779,10 @@ def test_read_datetime_multiindex(self, request, engine, read_ext):
17841779
reason="Sheets containing datetimes not supported by pyxlsb"
17851780
)
17861781
)
1787-
if engine == "calamine" and read_ext in {".xls", ".xlsb", ".ods"}:
1782+
if engine == "calamine" and read_ext in {".xls", ".xlsb"}:
17881783
request.node.add_marker(
17891784
pytest.mark.xfail(
1790-
reason="Calamine support parsing datetime only in xlsx"
1785+
reason="Calamine support parsing datetime only in xlsx/ods"
17911786
)
17921787
)
17931788

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ computation = ['scipy>=1.7.1', 'xarray>=0.21.0']
6262
fss = ['fsspec>=2021.07.0']
6363
aws = ['s3fs>=2021.08.0']
6464
gcp = ['gcsfs>=2021.07.0', 'pandas-gbq>=0.15.0']
65-
excel = ['odfpy>=1.4.1', 'openpyxl>=3.0.7', 'python-calamine>=0.1.0', 'pyxlsb>=1.0.8', 'xlrd>=2.0.1', 'xlsxwriter>=1.4.3']
65+
excel = ['odfpy>=1.4.1', 'openpyxl>=3.0.7', 'python-calamine>=0.1.1', 'pyxlsb>=1.0.8', 'xlrd>=2.0.1', 'xlsxwriter>=1.4.3']
6666
parquet = ['pyarrow>=7.0.0']
6767
feather = ['pyarrow>=7.0.0']
6868
hdf5 = [# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
@@ -104,7 +104,7 @@ all = ['beautifulsoup4>=4.9.3',
104104
'pytest>=7.0.0',
105105
'pytest-xdist>=2.2.0',
106106
'pytest-asyncio>=0.17.0',
107-
'python-calamine>=0.1.0',
107+
'python-calamine>=0.1.1',
108108
'python-snappy>=0.6.0',
109109
'pyxlsb>=1.0.8',
110110
'qtpy>=2.2.0',

scripts/tests/data/deps_expected_random.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ dependencies:
5757
- zstandard>=0.15.2
5858

5959
- pip:
60-
- python-calamine>=0.1.0
60+
- python-calamine>=0.1.1

scripts/tests/data/deps_minimum.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ computation = ['scipy>=1.7.1', 'xarray>=0.21.0']
6262
fss = ['fsspec>=2021.07.0']
6363
aws = ['s3fs>=2021.08.0']
6464
gcp = ['gcsfs>=2021.07.0', 'pandas-gbq>=0.15.0']
65-
excel = ['odfpy>=1.4.1', 'openpyxl>=3.0.7', 'python-calamine>=0.1.0', 'pyxlsb>=1.0.8', 'xlrd>=2.0.1', 'xlsxwriter>=1.4.3']
65+
excel = ['odfpy>=1.4.1', 'openpyxl>=3.0.7', 'python-calamine>=0.1.1', 'pyxlsb>=1.0.8', 'xlrd>=2.0.1', 'xlsxwriter>=1.4.3']
6666
parquet = ['pyarrow>=7.0.0']
6767
feather = ['pyarrow>=7.0.0']
6868
hdf5 = [# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
@@ -104,7 +104,7 @@ all = ['beautifulsoup4>=5.9.3',
104104
'pytest>=7.0.0',
105105
'pytest-xdist>=2.2.0',
106106
'pytest-asyncio>=0.17.0',
107-
'python-calamine>=0.1.0',
107+
'python-calamine>=0.1.1',
108108
'python-snappy>=0.6.0',
109109
'pyxlsb>=1.0.8',
110110
'qtpy>=2.2.0',

scripts/tests/data/deps_unmodified_random.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ dependencies:
5757
- zstandard>=0.15.2
5858

5959
- pip:
60-
- python-calamine>=0.1.0
60+
- python-calamine>=0.1.1

0 commit comments

Comments
 (0)