[PYTHON] Acquisition of past power consumption Kyushu Electric Power Edition

Introduction

I was holding a seminar on electricity usage forecast, and I heard that it is difficult to obtain it because the format of the past electricity consumption published by each electric power company is different. Therefore, I will summarize the data acquisition method for each electric power company.

By the way, the target electric power companies are Hokkaido Electric Power, Tohoku Electric Power, Tokyo Electric Power, Hokuriku Electric Power, Chubu Electric Power, Kansai Electric Power, Chugoku Electric Power, Shikoku Electric Power, Kyushu Electric Power, Okinawa Electric Power, and this time I will deal with Okinawa Electric Power. ..

Note: Repeating a large number of downloads will put a burden on the server, so please download only once or limit the target period.

Operating environment

It works in the environment called Colaboratory of Google.

Colaboratory

Website

It seems that you can download the data from the following website.

Kyushu Electric Power Transmission and Distribution Denki Forecast

download

python


for y in range(2016, 2020):
  for m in range(1,13):
    
    if y == 2016 and m < 4:
      continue
      
    for d in range(1, 32):
      url = "https://www.kyuden.co.jp/td_power_usages/csv/juyo-hourly-{:04}{:02}{:02}.csv".format(y, m, d)
      !wget $url

Read and visualize

python


from glob import glob
import pandas as pd

files = glob("*.csv")
files.sort()

df_juyo = pd.DataFrame()

for f in files:
  print("\r", f, end="")
  try:
    df = pd.read_csv(f, encoding="Shift_JIS", skiprows=7, nrows=24)
    d = df.DATE + " " + df.TIME
  except:
    df = pd.read_csv(f, encoding="Shift_JIS", skiprows=13, nrows=24)
  df.head()
  df_juyo = pd.concat([df_juyo, df])

df_juyo.index = pd.to_datetime(df_juyo["DATE"] + " " + df_juyo["TIME"])
df_juyo["Results on the day(10,000 kW)"].plot(figsize=(15,5))

ダウンロード.png

did it!

The upper limit of Okinawa Electric Power's graph was 1.4 million kWh, so Kyushu Electric Power's is about 10 times.

Also, the amount of electricity used has decreased significantly from the end of 2018, the beginning of 2019, and the end of 2019. What happened? I'll look it up.

Looking at the amount of electricity used, there are many things you notice. That's all for Kimura from the scene.

Supplement

The person who read the article asked me, "It takes too much time, so what should I do if I want the data quickly?", So I decided to sell the data for a while. If you are interested in the data, please see the URL below.

https://ticket.tsuku2.jp/eventsDetail.php?ecd=16260900020422

Recommended Posts

Acquisition of past power consumption Kyushu Electric Power Edition
Acquisition of past electricity usage Shikoku Electric Power Edition
Acquisition of past electricity usage Okinawa Electric Power Edition
Acquisition of past electricity usage Kansai Electric Power
Acquisition of past electricity usage China Electricity Edition