此包用于从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第三方库


热门话题
java集合属性值   java字符串==运算符是否比较引用?   java是否存在过太多的ListView或适配器?   json获取java中类路径中下载的文件   我可以用java代码解决数据库并发问题吗?   在多个线程中使用forEach()或使用forEach()和lambdas进行java集合迭代   java输出JFrame中的整个循环   java禁用高度详细的日志记录   java在没有特定属性的对象中访问模型的值   java Smack xmpp建立连接   处理过时域对象引起的并发问题的java策略(Grails/GORM/Hibernate)   java从ObservableList中提取元素   使用图像进行java相似图像搜索   java ListView和图像:我快疯了   在Java中,如何从毫秒时间戳中提取一天的周期?   java我需要这样的设计,但我面临两个问题   java如何获取JGoodies FormLayout中的单元格大小   Spring引导生成的java War文件未部署到Weblogic 12c