title: Writing multiple files from one pandas dataframe
body: <p>I have a CSV file that I'm trying to extract and break down into parts. It 10 columns. My current script (a line of which is shown below) asks user for input of two columns (say columns A and C) and gets data from the third (column F) and writes columns A and F to a new CSV file. </p>
  
  <pre><code>df1 = data.columnF[(data['columnA'] == data_name) &amp; (data['columnC'] == study_name)]
  </code></pre>
  
  <p>Current output looks something like this:</p>
  
  <pre><code>name1,study1
  name1,study2
  name1,study2
  name5,study9
  name6,study6
  name6,study0
  </code></pre>
  
  <p>Instead, I want the output to be multiple text files (by skipping the step of writing everything to CSV file and then breaking it into chunks). </p>
  
  <pre><code>File 'name1.txt' should have
  study1
  study2 (only once, without repetition) 
  </code></pre>
  
  <p>Similarly, </p>
  
  <pre><code>name5.txt &gt; study9
  name6.txt &gt; study6
              study0
  </code></pre>
  
  <p>How can I do that?</p>