Contents

1 覦覯1: [https]pysqldf 殊企襴 (https://pypi.python.org/pypi/pysqldf)
2 覦覯2: [https]pandasql 殊企襴 (https://pypi.python.org/pypi/pandasql)


覦覯1 . 蠏碁磯.. 覘螳 . 覦覯2襦 .

1 覦覯1: [https]pysqldf 殊企襴 (https://pypi.python.org/pypi/pysqldf) #

from pysqldf import SQLDF
import pandas as pd
import io

txt = io.StringIO("""
col1	col2
a	1
b	2
c	3
d	4
""")

df = pd.read_csv(txt, sep="\t")
df

sqldf = SQLDF(globals())
sqldf.execute("select * from df limit 3;")

2 覦覯2: [https]pandasql 殊企襴 (https://pypi.python.org/pypi/pandasql) #

from pandasql import sqldf
import pandas as pd
import io

txt = io.StringIO("""
col1	col2
a	1
b	2
c	3
d	4
""")

df = pd.read_csv(txt, sep="\t")
df

pysqldf = lambda q: sqldf(q, globals())
df2 = pysqldf("select * from df limit 3;")
df2