Last active
August 12, 2021 21:06
-
-
Save ceaksan/2a234ca147e8bfd370ca717d9ce86190 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!pip install tabula-py | |
#!java -version | |
import tabula | |
import pandas as pd | |
# NEW VERSION | |
url = "https://fenbil.aku.edu.tr/FENBILENS/takvim/2014-2022-1RESMI.pdf" | |
df = tabula.read_pdf(url, pages='all') | |
holidayList = [] | |
''' | |
for j in range(len(df)): | |
for lab, row in pd.Series(df)[j].iterrows(): | |
for i in row: | |
holidayList.append(i) | |
''' | |
for i in range(len(df)): | |
for val in df[i].values: | |
for j in pd.Series(val): | |
holidayList.append(j) | |
holidays = pd.DataFrame(holidayList, columns=['ds']).applymap(lambda x: '-'.join(x.split()[0:3])) | |
d = { | |
'Ocak':'01', | |
'Şubat':'02', | |
'Mart':'03', | |
'Nisan':'04', | |
'Mayıs':'05', | |
'Haziran':'06', | |
'Temmuz':'07', | |
'Ağustos':'08', | |
'Eylül':'09', | |
'Ekim':'10', | |
'Kasım':'11', | |
'Aralık':'12', | |
} | |
holidays = pd.to_datetime(holidays['ds'].replace(d, regex=True), format='%d-%m-%Y') | |
holidays.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OLD VERSION