Pandas version checks
-
[X] I have checked that this issue has not already been reported.
-
[X] I have confirmed this bug exists on the latest version of pandas.
-
[X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
dataframe = pd.read_excel(<existing_file>, sheet_name="All CCC", header=5)
writer = pd.ExcelWriter(<os_path/non_existing_folder/some_filename>, engine="openpyxl")
dataframe.to_excel(writer, sheet_name="final")
writer.close()
Issue Description
this will throw error "file not found" located in the zip standard python package because it will attempt to open() but the folder of the file does not exist.
Expected Behavior
panda's should create all necessary parent folders like mkdir -p option
Installed Versions
Comment From: MarcoGorelli
thanks @davidszkl for the suggestion
panda's should create all necessary parent folders like mkdir -p option
I really think this is out-of-scope for pandas, I'm generally -1 on magic things happening under-the-hood - you can create the directories yourself with, for example, os.makedirs(exist_ok=True)