alston_exp.py 846 B

12345678910111213141516171819202122232425
  1. import dataset
  2. from pymysql import*
  3. import xlwt
  4. import pandas.io.sql as sql
  5. # connect the mysql with the python
  6. con=connect(user="choozmo",password="pAssw0rd",host="db.ptt.cx",database="google_poi")
  7. # read the data
  8. #df=sql.read_sql('select * from shop_list2',con)
  9. #df=sql.read_sql('SELECT * FROM google_poi.swire_store_list where keyword = "火鍋";',con)
  10. #df=sql.read_sql('SELECT name,fid,addr,place_id,keyword,num,crawler_date FROM google_poi.swire_store_list where keyword = "火鍋"',con)
  11. #df=sql.read_sql('SELECT * FROM google_poi.swire_store_list where keyword = "火鍋餐廳"',con)
  12. #df=sql.read_sql('SELECT * FROM google_poi.swire_store_list ',con)
  13. df=sql.read_sql('SELECT * FROM google_poi.shop_list3; ',con)
  14. # print the data
  15. print(df)
  16. # export the data into the excel sheet
  17. #df.to_excel('hot_pot.xls')
  18. df.to_excel('details.xls')