Skip to content

Commit

Permalink
Use xlsx instead of xls due to Pandas deprecating xls
Browse files Browse the repository at this point in the history
  • Loading branch information
dhadka committed Sep 5, 2024
1 parent 3d14156 commit 29eb2d0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ Rhodium.egg-info/
*.o
*.pyc
*.so
*.xlsx
.Rhistory
.DS_Store
4 changes: 2 additions & 2 deletions examples/Eijgenraam/eijgenraam_mordm.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ def find_height(t):
##==============================================================================
## Export the data (Excel, CSV, JSON, pickle)
##------------------------------------------------------------------------------
if promptToRun("Save policies to Excel (eijgenraam_mordm.xls)?"):
policies.save("eijgenraam_mordm.xls")
if promptToRun("Save policies to Excel (eijgenraam_mordm.xlsx)?"):
policies.save("eijgenraam_mordm.xlsx")

##==============================================================================
## Display all the data in a pretty format
Expand Down
21 changes: 11 additions & 10 deletions rhodium/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,20 @@
import sys

def promptToRun(message, default="yes"):
if os.getenv("RHODIUM_NO_PROMPT"):
response = ""
if default == "yes":
prompt = "[Y/n]"
elif default == "no":
prompt = "[y/N]"
else:
if default == "yes":
prompt = "[Y/n]"
elif default == "no":
prompt = "[y/N]"
else:
raise ValueError("invalid default answer")
raise ValueError("invalid default answer")

print(message + " " + prompt + " ", end='')
sys.stdout.flush()
print(message + " " + prompt + " ", end='')
sys.stdout.flush()

if os.getenv("RHODIUM_NO_PROMPT"):
print("(Skipping prompt since RHODIUM_NO_PROMPT is set)")
response = ""
else:
response = sys.stdin.readline().strip()

if response == "":
Expand Down

0 comments on commit 29eb2d0

Please sign in to comment.