pandas: write tab-separated dataframe with literal tabs with no quotes
<p>I have to reformat my data for a genetics software which requires to split each column into two, e.g <code>0-&gt; G G; 1-&gt; A G; 2 -&gt; A A;</code>. The output file is supposed to be tab-delimited. I am trying to do it in pandas:</p>

<pre><code>import csv
import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.randint(0,3, size = (10,5)), 
                  columns=[ chr(c) for c in range(97, 97+5) ])

def fake_alleles(x):
    if x==0:
        return "A\tA"
    if x==1:
        return "A\tG"
    if x==2:
        return "G\tG"

plinkpast6 = df.applymap(fake_alleles)
plinkpast6.to_csv("test.ped", sep="\t", quoting=csv.QUOTE_NONE)
</code></pre>

<p>Which gives me an error <code>Error: need to escape, but no escapechar set</code>. Are there other ways to do it with <code>pandas</code>? </p>