Code Sample, a copy-pastable example if possible

#!/usr/bin/python

import MySQLdb
import pandas as pd
import pprint as pp
import os
import sys
import HTMLParser
parser = HTMLParser.HTMLParser()

def get_script_path():
    return os.path.dirname(os.path.realpath(sys.argv[0]))
script_path = get_script_path() 

db = MySQLdb.connect("","","","" )

df = pd.read_sql("SELECT * from test limit 1000",db)

df.to_json(script_path+'/query_resutls.json')

Problem description

I got a plain 'Segmentation fault: 11' when running this code on the Terminal.app I believe the problem was that one of the columns had currency names encoded in HTML. The USD are encoded as "Dólares" from the spanish "Dólares".

pandas (0.20.3) Python 2.7.13 MacOS High Sierra 10.13.2

Output of pd.show_versions()

[paste the output of ``pd.show_versions()`` here below this line] INSTALLED VERSIONS ------------------ commit: None python: 2.7.13.final.0 python-bits: 64 OS: Darwin OS-release: 17.3.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: None LOCALE: None.None pandas: 0.20.3 pytest: None pip: 9.0.1 setuptools: 36.6.0 Cython: None numpy: 1.13.3 scipy: None xarray: None IPython: 5.4.1 sphinx: None patsy: None dateutil: 2.6.1 pytz: 2017.2 blosc: None bottleneck: None tables: None numexpr: None feather: None matplotlib: None openpyxl: None xlrd: None xlwt: None xlsxwriter: None lxml: None bs4: 4.6.0 html5lib: 0.9999999 sqlalchemy: None pymysql: None psycopg2: None jinja2: 2.9.6 s3fs: None pandas_gbq: None pandas_datareader: None

Comment From: chris-b1

Using the mysql library directly is as far as I understand deprecated in favor of using sqlalchemy - what happens if you use it? https://pandas.pydata.org/pandas-docs/stable/io.html#sql-queries

Comment From: ghost

I worked around this.