标签:col com alc 分享图片 一个 for numpy timestamp xlsx
import pandas as pd
import numpy as np
import os
from sqlalchemy import create_engine
def get_station_weather(sql_engine,sid):
data = pd.read_sql_query(
"SELECT Station_Id_c, WIN_D_Avg_10mi, TimeStamp, WIN_S_Avg_10mi FROM Weather_Station_Hour "
" where Station_Id_c=‘%s‘ORDER BY TimeStamp"% (sid),sql_engine)
return data
if __name__ == ‘__main__‘:
sql_engine = create_engine(‘mssql+pymssql://**********************‘)
#——————————————————————————玉林小时风速风向————————————————————————————
yulin_station_id=[‘59449‘,‘59457‘,‘59451‘,‘59452‘]
writer = pd.ExcelWriter(‘/data01/home/gzblue/xgx/weizhan/yulin_weather.xlsx‘)
for sid in yulin_station_id:
station_59449 = get_station_weather(sql_engine,sid=sid)
print(station_59449)
station_59449.to_excel(excel_writer=writer,sheet_name=sid)
writer.save()
writer.close()
结果:
标签:col com alc 分享图片 一个 for numpy timestamp xlsx
原文地址:https://www.cnblogs.com/avivi/p/10233918.html