Guest User

Untitled

a guest
Mar 17th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #!/usr/bin/python3
  2. import pymysql
  3. import pandas as pd
  4. import numpy as np
  5.  
  6. conn = pymysql.connect(host="127.0.0.1", port=3306, user="root", password="darrenzhou",db="world", charset = "utf8")
  7. cursor=conn.cursor()
  8.  
  9. # cursor.execute("select * from city")
  10.  
  11. # row_1 = cursor.fetchone()
  12. # print(row_1)
  13. # row_3 = cursor.fetchall()
  14. query = "select * from city limit 10"
  15. df = pd.read_sql(query, conn)
  16. conn.commit()
  17. cursor.close()
  18. conn.close()
Add Comment
Please, Sign In to add comment