此包用于从www.worldwatheronline.com检索历史天气数据并将其转换为pandas dataframe和csv。

wwo-hist的Python项目详细描述


WorldWeatherOnline历史天气数据API包装器

此包用于检索历史天气数据,并将其从www.worldweatheronline.com转换为pandas dataframe和csv。

您可以免费获得API密钥(自2019年5月30日起60天内免费试用500个请求/密钥)。

API资源管理器示例:https://www.worldweatheronline.com/developer/premium-api-explorer.aspx

安装软件包:

pip install wwo-hist

导入包

fromwwo_histimportretrieve_hist_data

设置工作目录以存储输出csv文件
importosos.chdir(".\YOUR_PATH")

输入:API键、位置列表、开始日期、结束日期、频率

输出:location_name.csv

示例代码

frequency=3start_date='11-DEC-2018'end_date='11-MAR-2019'api_key='YOUR_API_KEY'location_list=['singapore','california']hist_weather_data=retrieve_hist_data(api_key,location_list,start_date,end_date,frequency,location_label=False,export_csv=True,store_df=True)

参数:

api_key: string
(Premium/ free trial) API key from worldweatheronline.com

location_list: list of string
US Zipcode, UK Postcode, Canada Postalcode, IP address, Latitude/Longitude (decimal degree) or city name

start_date: string
Preferred date format: 'dd-mmm-yyyy'

end_date: string
Preferred date format: 'dd-mmm-yyyy'

frequency: integer
1, 3, 6, 12, 24
1 hourly, 3 hourly, 6 hourly, 12 hourly (day/night) or 24 hourly (day average)

location_label: bool, default = False
If True, all column names will have city name as prefix.

export_csv: bool, default = True
If False, no csv file will be exported to current directory.

store_df: bool, default = False
If True, retrieved dataframe(s) will be stored as list in the work space.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
ArrayList中实体对象上的JAVA泛型   带Redis的爪哇芹菜vs单用Redis   java在设备面向横向时隐藏标题栏/通知栏   java JXTreeTable:如何使用ComponentProvider为一列设置渲染器   java创建异常的成本与记录异常的成本相比   java在方法参数中使用setter传递新对象   java在一个类中的方法与另一个类中的方法交互时遇到问题   java如何迭代2个大小相等的ArrayList   Java getDesktop()。open在Windows中工作,但在Mac中不工作   从tomcat切换到jetty后的java“无法启动嵌入式容器”,Spring引导   java如何使用void方法   java如何在解组时在JAXB的ValidationEventHandler中获取节点值?   如何使用Akka Java API创建不响应的TCP接收器   JavaScriptjQuery在java中将记录上传到数据库时的进度条   如何在重新绘制时在java小程序中显示上一个图像