Save pandas csv to sub-directory
<p>I am trying to save the output of the following code to a subdirectory:</p>

<pre><code>for gp in g:
    filename = gp[0] + '.csv'
    print(filename)
    gp[1].to_csv(filename)
</code></pre>

<p>I have created the subdirectory first:</p>

<pre><code>os.makedirs('MonthlyDataSplit')
</code></pre>

<p>But I can't find any information as to how to use <code>to_csv</code> to save to a subdirectory rather than the current directory. One approach I was thinking was to use the <code>with "MonthlyDataSplit" open as directory</code> but I can only find the equivalent for opening a file in a subdirectory.</p>