Код:
Код: Выделить всё
import evds as e
from datetime import datetime
import pandas as pd
import os
evds = e.evdsAPI("MY APİ CODE, U can try yours")
bugun = datetime.today().strftime('%d-%m-%Y')
startdate = "01.01.2003"
enddate = bugun
series_codes = [
"TP.GSYIH20.HY.ZH",
"TP.GSYIH27.HY.ZH",
"TP.GSYIH21.HY.ZH",
"TP.GSYIH22.HY.ZH",
"TP.GSYIH24.HY.ZH",
"TP.GSYIH25.HY.ZH",
"TP.GSYIH26.HY.ZH"
]
data_frames = [evds.get_data(series=[code], startdate=startdate, enddate=enddate, frequency=6) for code in series_codes]
evds_data = pd.concat(data_frames, axis=1)
evds_data = evds_data.drop("Tarih", axis=1)
isimler = [
"Yerleşik hanehalklarının tüketimi (Tutarlar Bin TL)",
"Hanehalkına hizmet eden kar amacı olmayan kuruluşların tüketimi",
"Devletin nihai tüketim harcamaları",
"Gayrisafi sabit sermaye oluşumu",
"Mal ve hizmet ihracatı",
"(Eksi) Mal ve hizmet ithalatı",
"Gayrisafi yurtiçi hasıla"
]
evds_data.columns = isimler
tarih = pd.date_range(start=startdate, periods=len(evds_data), freq="Q")
evds_data.set_index(tarih, inplace=True)
excel_dosyasi = "C:/Users/HP VİCTUS/Desktop/Şirket Evrakları/Database/EVDS/GSYIH.xlsx"
sayfa_adı = "Tuketim"
if os.path.exists(excel_dosyasi):
mevcut_data = pd.read_excel(excel_dosyasi, sheet_name=sayfa_adı, index_col=0)
evds_data = pd.concat([mevcut_data, evds_data])
evds_data = evds_data[~evds_data.index.duplicated(keep='last')] # Yinelenen tarihleri kaldır
with pd.ExcelWriter(excel_dosyasi, mode='a', if_sheet_exists='replace') as writer:
evds_data.to_excel(writer, sheet_name=sayfa_adı)
Код: Выделить всё
EVDSConnectionError: Connection error, please check your API Key or request. Url:https://evds2.tcmb.gov.tr/service/evds/series=TP.GSYIH20.HY.ZH&startDate=01.01.2003&endDate=17-07-2024&type=json&formulas=&frequency=6&aggregationTypes=
Подробнее здесь: https://stackoverflow.com/questions/787 ... de-i-wrote