Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read xlsx #94

Merged
merged 8 commits into from Jan 7, 2021
Merged

Read xlsx #94

merged 8 commits into from Jan 7, 2021

Conversation

tralsos
Copy link
Collaborator

@tralsos tralsos commented Dec 21, 2020

Changes pd.read_excel to use engine openpyxl since newer versions of xlrd does not support '.xlsx' files. Closes issue #88 . Requirements are updated to use pandas>1.1 and xlrd>2.0, but shold also work with previous requirements if we don't want to change these yet.

@tralsos tralsos requested a review from berland December 21, 2020 13:23
@tralsos
Copy link
Collaborator Author

tralsos commented Dec 21, 2020

@jcrivenaes should we change the requirements as suggested here, or are there reasons to keep the previous requirements ?

@berland
Copy link
Collaborator

berland commented Dec 21, 2020

We should not enforce versions that are not yet in komodo stable. Pandas 1.1 is on its way in now, but xlrd might take another month or so.

)

print(dgn.loc[0]["SENSCASE"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a debugging statement?

"Design matrix filename should be on Excel or csv format"
" and end with .xlsx or .csv"
"Design matrix should be on Excel or csv format"
" and filename should end with .xlsx or .csv"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"should -> must" is perhaps more to the point (.XLSX would even fail here, but we can live with that.)

@@ -53,15 +53,17 @@ def summarize_design(filename, sheetname="DesignSheet01"):

# Read design matrix and find realisation numbers for each sensitivity
if filename.endswith(".xlsx"):
dgn = pd.read_excel(filename, sheetname)
dgn = pd.read_excel(filename, sheetname, engine="openpyxl")
dgn.dropna(axis=0, how="all", inplace=True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this due to things like "coloured cells"? If so, maybe nice to add a comment about that (to explain why the line of code is there, otherwise it could disappear in later refactorings)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have added this

@tralsos tralsos mentioned this pull request Jan 4, 2021
@berland
Copy link
Collaborator

berland commented Jan 7, 2021

Test pass on combinations of xlrd 1.2.0/2.0.1, and pandas versions 0.25 up to 1.2.0. Except Pandas 1.1.1, but this particular version is not in use.

@berland berland merged commit 6fdf3fd into equinor:master Jan 7, 2021
@berland berland mentioned this pull request Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants