12345678910111213141516171819202122232425 |
- import dataset
- from pymysql import*
- import xlwt
- import pandas.io.sql as sql
- # connect the mysql with the python
- con=connect(user="choozmo",password="pAssw0rd",host="db.ptt.cx",database="google_poi")
- # read the data
- #df=sql.read_sql('select * from shop_list2',con)
- #df=sql.read_sql('SELECT * FROM google_poi.swire_store_list where keyword = "火鍋";',con)
- #df=sql.read_sql('SELECT name,fid,addr,place_id,keyword,num,crawler_date FROM google_poi.swire_store_list where keyword = "火鍋"',con)
- #df=sql.read_sql('SELECT * FROM google_poi.swire_store_list where keyword = "火鍋餐廳"',con)
- #df=sql.read_sql('SELECT * FROM google_poi.swire_store_list ',con)
- df=sql.read_sql('SELECT * FROM google_poi.shop_list3; ',con)
- # print the data
- print(df)
- # export the data into the excel sheet
- #df.to_excel('hot_pot.xls')
- df.to_excel('details.xls')
|