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

INSTALLED VERSIONS ------------------ commit : None python : 3.8.10.final.0 python-bits : 64 OS : Linux OS-release : 5.15.0-53-generic machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8

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)