I have a Pandas Dataframe generated from a database, which has data with mixed encodings. For example:
+----+-------------------------+----------+-----------
Using external tool pandoc and pipe:
pandoc
def to_markdown(df): from subprocess import Popen, PIPE s = df.to_latex() p = Popen('pandoc -f latex -t markdown', stdin=PIPE, stdout=PIPE, shell=True) stdoutdata, _ = p.communicate(input=s.encode("utf-8")) return stdoutdata.decode("utf-8")