<jupyter_start><jupyter_text>Define SQL statement<jupyter_code>sql_statement = """ select bathroom,bedroom
            from public.house_price_full
            where bathroom>2"""<jupyter_output><empty_output><jupyter_text>Cursor Executes the SQL statement<jupyter_code>cur.execute(sql_statement)
cur.fetchone()
for bathroom,bedroom in cur.fetchall()[:10]:
    print(bathroom,bedroom)
df = pandas.read_sql_query(sql_statement,conn)
df[:]
sql_statement= """
                select built_in,
                avg(price) as avg_price
                from public.house_price_full
                group by built_in
                order by built_in
                """
df = pandas.read_sql_query(sql_statement,conn)
df[:10]
df_price=pandas.read_sql_query(sql_statement,conn)

df_price.plot(y='avg_price',x='built_in')
sql_statement= """
                select price,area
                from public.house_price_full
                """
df_price=pandas.read_sql_query(sql_statement,conn)

df_price[:10]
df_price=pandas.read_sql_query(sql_statement,conn)

df_price['area'].hist()
df_price=pandas.read_sql_query(sql_statement,conn)

df_price.plot.scatter(x='area',y='price')
sql_statement= """
                select house_type,
                avg(price) as avg_price
                from public.house_price_full
                group by house_type
                order by avg_price desc
                """
df_price=pandas.read_sql_query(sql_statement,conn)

df_price.plot.bar(x='house_type',y='avg_price')
sql_statement = """
                insert into gp1.student(s_email,s_name,s_major)
                values('{}','{}','{}')
                                
                """.format('<EMAIL>','s5','ia')

print(sql_statement)
conn.rollback()
sql_statement = """
                insert into gp1.student(s_email,s_name,s_major)
                values('{}','{}','{}')
                                
                """.format('<EMAIL>','s6','ia')
cur.execute(sql_statement)
conn.commit()
df_student=pandas.read_sql_query('select * from gp1.student',conn)
df_student[:]
sql_statement = """
                delete from gp1.student
                where s_email = '{}'
                """.format('<EMAIL>')
print(sql_statement)
cur.execute(sql_statement)
conn.commit()
cur.close()
conn.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12844827586206897, 'fraction_numerical': 0.005603448275862069, 'mean_word_length': 2.632237871674491, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '6065', 'license': 'MIT', 'n_tokens_mistral': 765, 'n_tokens_neox': 728, 'n_words': 101, 'path': 'lec4.ipynb', 'repo_name': 'epicha/ia340', 'size': '2329'}