Goal: create either a Dataframe in memory or store file locally.
Struggling to decode Excel files; I can decode all other file types.
Code:
from MinioConn import MinioConn
from io import StringIO
import pandas as pd
import os
client = MinioConn().client()
obj = client.get_object('bucket-name', 'dir/file.xls')
print(type(obj))
print(obj.read())
filename = 'temp.xlsx'
new_file = open(filename, 'w')
try:
new_file.write(obj.response) # .content
new_file.close()
df = pd.read_excel(filename)
except:
os.remove(filename)
Traceback:
<class 'urllib3.response.HTTPResponse'>
2\n\x00q\x0b\x00\x00@\x00\x00\x00,@\xfd\x00\n\x00q\x0b\x01\x00\x0f\x00\xc2\x02\x00\x00\xfd\x00\n\x ...
Please let me know if I should add anything else to post/ clarify.