title: Pandas - Formatting dataframe rows not working
body: <p>I am trying to format the rows of my data frame, without success.</p>
  
  <p>My data frame output is:</p>
  
  <pre><code>                       X                              Y
  443   cd2a9dd781c1396d4000ae05fcc3a0b00a5dc4f9     889.825    
  111   ae3faf7ed08967e93d5f5ed6e10a5b256ec8c7fa     883.275    
  221   601f669c760687b84ec57fe1eec213e26114a262     868.345   
  631   80f54ce2aa2839e80cd5447cb369ec31f5e1fd47     867.545   
  </code></pre>
  
  <p>I would like the output in the following format:</p>
  
  <pre><code>{"X": "cd2a9dd781c1396d4000ae05fcc3a0b00a5dc4f9", "Y": 889.8}
  {"X": "ae3faf7ed08967e93d5f5ed6e10a5b256ec8c7fa", "Y": 883.2}
  </code></pre>
  
  <p>I tried with:</p>
  
  <pre><code>format = '{"X": "{}", "Y": {%.1f}}'.format
  my_df.apply(lambda x: format(**x), 1)
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>my_df.style.format({'X': '{"X": "{}",', 'Y': '"Y": {%.1f}}'})
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>my_df.to_string(formatters={'X':'"X": "{}",'.format, 'Y':'"Y": {%.1f}'.format})
  </code></pre>
  
  <p>None worked for me. This last attempt (<code>to_string</code>) is returning the following error:</p>
  
  <blockquote>
    <p>File "/usr/local/lib/python3.5/dist-packages/pandas/io/formats/format.py", line 1781, in get_result<br>
        fmt_values = self._format_strings()<br>
      File "/usr/local/lib/python3.5/dist-packages/pandas/io/formats/format.py", line 1961, in _format_strings<br>
        return [self.formatter(x) for x in self.values]<br>
      File "/usr/local/lib/python3.5/dist-packages/pandas/io/formats/format.py", line 1961, in <br>
        return [self.formatter(x) for x in self.values]<br>
    KeyError: '%'</p>
  </blockquote>
  
  <p>Any suggestion/help?</p>