We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 401f4cf commit 4e63db0Copy full SHA for 4e63db0
src/penn_chime/utils.py
@@ -6,7 +6,7 @@
6
7
8
def dataframe_to_base64(df: pd.DataFrame) -> str:
9
- """Converts a dataframe to a base64-encoded CSV representation of that data.
+ """Converts a dataframe into csv base64-encoded data.
10
11
This is useful for building datauris for use to download the data in the browser.
12
@@ -18,7 +18,7 @@ def dataframe_to_base64(df: pd.DataFrame) -> str:
18
return b64
19
20
21
-def excel_to_base64(str_excel_filename) -> str:
22
- data = open(str_excel_filename, 'rb').read()
23
- b64 = b64encode(data).decode()
24
- return b64
+def excel_to_base64(filename: str) -> str:
+ """Converts an excel document into base64-encoded data."""
+ with open(filename, 'rb') as fin:
+ return b64encode(fin.read()).decode()
0 commit comments