Day 6: convert_pdf_to_csv
This script helps you to convert the given PDF into CSV file and stores it in local
from tabula import read_pdf
import pandas as pd
FILE_NAME="" #Ppdf file as input
dest="" #destination csv file name
df= read_pdf(FILE_NAME)
x=df.values
data=pd.DataFrame(data=x[1:,1:],columns=x[0,1:])
data.to_csv(dest,sep=',',encoding="utf-8")
Day 7: push_todays_script
This script will automatically track the updated files and commit those files and push them to the git.
import os,subprocess
from constants import WORKING_DIR
os.chdir(WORKING_DIR)
cmd = "git add ."
subprocess.check_output(cmd, shell=True)
status= "git status -s"
returned_value = subprocess.check_output(status, shell=True)
print('updated files:', returned_value)
if not returned_value==b'':
commit_message='"Done Changed in the following files '
if len(str(returned_value).split(r'\n'))>0:
for file_name in str(returned_value).split(r'\n'):
commit_message=commit_message+file_name[5:]+" "
cmd= "git commit -m "+commit_message+r'"'
print("Commit message ",subprocess.check_output(cmd, shell=True))
try:
cmd= "git push origin master"
result = subprocess.check_output(cmd, shell=True)
print(result)
except:
cmd = "git pull"
returned_value = subprocess.check_output(cmd, shell=True)
cmd = "git push origin master"
result = subprocess.check_output(cmd, shell=True)
print(result)
Please Visit my Git Repo to check out all the previous day challenges.
Top comments (0)