Skip to content

Commit

Permalink
Merge pull request #225 from berland/pandas12
Browse files Browse the repository at this point in the history
Pandas 1.2.0 compatibility
  • Loading branch information
berland authored Dec 28, 2020
2 parents 5b99748 + 79ab2b0 commit 4ff1230
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: no-commit-to-branch
args: ['--branch', 'master']
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
Expand Down
8 changes: 5 additions & 3 deletions pyscal/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,13 +1068,15 @@ def infer_tabular_file_format(filename):
try:
pd.read_excel(filename, engine="openpyxl")
return "xlsx"
except openpyxl.utils.exceptions.InvalidFileException:
# We get here for both CSV and XLS files.
except (ValueError, OSError, openpyxl.utils.exceptions.InvalidFileException):
# < Pandas 1.2, we get InvalidFileException from openpyxl
# >= Pandas 1.2.0: CSV gives ValueError,
# XLS gives OSError
pass
try:
pd.read_excel(filename, engine="xlrd")
return "xls"
except xlrd.biffh.XLRDError:
except (ValueError, xlrd.biffh.XLRDError):
# We get here for both CSV and XLSX files.
pass
try:
Expand Down

0 comments on commit 4ff1230

Please sign in to comment.