【发布时间】:2020-11-06 03:08:03
【问题描述】:
我刚刚通过 REST API 获取数据并想将其保存在 mysql 数据库中。由于我是初学者,只是寻找一种将数据保存到我的 sql 数据库中的方法。你们能否建议我一些教程/库/示例。那将是很大的帮助。谢谢。如果我反对 stackoverflow 的条款和条件,我真的很抱歉。但在这个话题上我真的需要帮助。
**from entsoe import EntsoePandasClient
import pandas as pd
client = EntsoePandasClient(api_key='api-key')
start = pd.Timestamp('20171201', tz='Europe/Brussels')
end = pd.Timestamp('20180101', tz='Europe/Brussels')
country_code = 'BE' # Belgium
# methods that return Pandas Series
client.query_day_ahead_prices(country_code, start=start,end=end)
client.query_load(country_code, start=start,end=end)
client.query_load_forecast(country_code, start=start,end=end)
client.query_generation_forecast(country_code, start=start,end=end)
# methods that return Pandas DataFrames
client.query_wind_and_solar_forecast(country_code, start=start,end=end, psr_type=None)
client.query_generation(country_code, start=start,end=end, psr_type=None)
client.query_installed_generation_capacity(country_code, start=start,end=end, psr_type=None)
client.query_crossborder_flows('DE', 'DK', start=start,end=end)
client.query_imbalance_prices(country_code, start=start,end=end, psr_type=None)
client.query_unavailability_of_generation_units(country_code, start=start,end=end, docstatus=None)
#client.query_withdrawn_unavailability_of_generation_units('DE', start=start,end=end)
ts = client.query_day_ahead_prices(country_code, start=start, end=end)
print(ts)**
【问题讨论】:
标签: python mysql pandas web-scraping rest