2 weeks ago
I have a couple things going on here.
First, to explain what I'm doing, I'm passing an array of objects in to a function that contain a dataframe per item. I want to write those dataframes to an excel workbook - one dataframe per worksheet. That part is working. Where I run into isues is when I attempt to append worksheets to an existing workbook (ExcelWriter mode='a' instead of 'w').
I've got a template workbook that lives out on DBFS that I copy local so I can append to it. See Limitations of Working with Files where it talks about Zip and Excel files and suggests working local and copying out to a Volume after.
I successfully copy the file locally and can copy it back out elsewhere if I comment out the ExcelWriter block.
With the ExcelWriter block in place and using the append mode I receive a FileNotFoundError telling me no such file exists. That error occurs in Pandas/io/common/get_handle() when it attempts to open the file.
Anyone know what's going on with Pandas not being able to see files on local_disk0?
FileNotFoundError: [Errno 2] No such file or directory
a week ago
Hey @data-grassroots , I did some digging with our internal docs and have some suggestions/tips to help you further diagnose the issue:
os.path.exists('/local_disk0/tmp/excel.xlsx')
just before the ExcelWriter call to confirm file presence and visibility in Python.python
with pd.ExcelWriter('/local_disk0/tmp/excel.xlsx', mode='a', engine='openpyxl') as writer:
df.to_excel(writer, sheet_name='NewSheet')
2 weeks ago
2 weeks ago
Here's a pretty easy way to recreate the issue - simplified to ignore the ExcelWriter part...
You can see the file is copied and shows up when listed. But can't be find from Pandas. Same behavior on local_disk0 and /tmp
a week ago
Hey @data-grassroots , I did some digging with our internal docs and have some suggestions/tips to help you further diagnose the issue:
os.path.exists('/local_disk0/tmp/excel.xlsx')
just before the ExcelWriter call to confirm file presence and visibility in Python.python
with pd.ExcelWriter('/local_disk0/tmp/excel.xlsx', mode='a', engine='openpyxl') as writer:
df.to_excel(writer, sheet_name='NewSheet')
Thursday
Hello @data-grassroots!
Were you able to resolve this? If any of the suggestions shared above helped, or if you found another solution, it would be great if you could mark it as the accepted solution or share your approach with the community.
Passionate about hosting events and connecting people? Help us grow a vibrant local communityโsign up today to get started!
Sign Up Now