Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
IO: Excel, attempt to fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
ebranlard committed Oct 20, 2023
1 parent c84ae1f commit b44e1fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pyFAST/case_generation/examples/Example_ExcelFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def main(run=True):

# --- Reading Excel file, converting it to a list of dictionaries, and generate input files
dfs = io.excel_file.ExcelFile(parametricFile).toDataFrame()
try:
if isinstance(dfs, dict):
df = dfs[list(dfs.keys())[0]]
except:
else:
df = dfs
PARAMS = df.to_dict('records')
fastFiles=case_gen.templateReplace(PARAMS, ref_dir, outputDir=work_dir, removeRefSubFiles=True, removeAllowed=False, main_file=main_file)
Expand Down
7 changes: 2 additions & 5 deletions pyFAST/input_output/excel_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ def formatName():
def _read(self):
self.data=dict()
# Reading all sheets
try:
xls = pd.ExcelFile(self.filename, engine='openpyxl')
except:
xls = pd.ExcelFile(self.filename)
xls = pd.ExcelFile(self.filename, engine='openpyxl')
dfs = {}
for sheet_name in xls.sheet_names:
# Reading sheet
Expand Down Expand Up @@ -70,7 +67,7 @@ def _write(self):
writer.save()

def __repr__(self):
s ='Class XXXX (attributes: data)\n'
s ='Class ExcelFile (attributes: data)\n'
return s


Expand Down

0 comments on commit b44e1fc

Please sign in to comment.