title: Saving dataframes to .csv and create folder without specifying the file path
body: <p>I am trying to find a way to save a few dataframes to .csv format as part of a ML routine I am designing in Python. Since this is composed of multiple steps, I would like to create folders in which to save dataframes as part of the code. Since the <code>pandas.DataFrame.to_csv</code> does not allow you to create folders, I have found this solution using <code>os</code>:</p>
  <pre><code>import os
  
  import pandas as pd
      
  outname = 'name.csv'
      
  outdir = './dir'
  if not os.path.exists(outdir):
      os.mkdir(outdir)
      
  fullname = os.path.join(outdir, outname)    
      
  df.to_csv(fullname)
  </code></pre>
  <p>However, this method requires you to specify the directory path. Since I would like the code to run on multiple devices without the need to rewrite the specific <code>outdir</code> each time, I am looking for a way to create a folder within the current Python working directory (whichever that may be on each device) in which to save the .csv file without the need to write down the path.</p>