Agence météorologique [Liste des stations météorologiques régionales [format de compression ZIP]](https: //www.jma. go.jp/jma/kishou/know/amedas/ame_master.zip) est utilisé. Le contenu du fichier zip est uniquement ʻame_master.csv`
python
import requests
import zipfile
import io
import pandas as pd
url = 'https://www.jma.go.jp/jma/kishou/know/amedas/ame_master.zip'
csv_name = 'ame_master.csv'
zip_res = requests.get(url)
with zipfile.ZipFile(io.BytesIO(zip_res.content)) as zip_f:
csv_data = zip_f.read(csv_name)
df = pd.read_csv(io.BytesIO(csv_data), encoding='cp932')
Recommended Posts