Writing a Python Pandas DataFrame to Word document
<p>I'm working on creating a Python generated report that uses Pandas DataFrames. Currently I am using the <code>DataFrame.to_string()</code> method. However this writes to the file as a string. Is there a way for me to achieve this while keeping it as a table so I can use table formating.</p>

<p>Code:</p>

<pre><code>SEMorgkeys = client.domain_organic(url, database = "us", display_limit = 10, export_columns=["Ph,Pp,Pd,Nq,Cp,Ur,Tr"])
org_df = pd.DataFrame(SEMorgkeys)

f = open(name, 'w')
f.write("\nOrganic:\n")
f.write(org_df.to_string(index=False,justify="left"))
f.close()
</code></pre>

<p>Current Printout (as string):</p>

<pre><code>CPC    Keyword                        Position Difference Previous Position Search Volume Traffic (%) Url                                               
75.92       small business factoring   0                   1                 210          11.69       https://www..com/small-business-f...
80.19              factoring company   0                   8                1600           5.72       https://www..com/factoring-vs-ban...
</code></pre>