├── README.md ├── Remote Work Series ├── AutomateRemoteWork_spreadsheets.py ├── RemoteWorkerAutomation-Websites.py ├── RemoteWorkerAutomation_files.py └── api_automate.py └── Sample Data ├── PriceBook.xlsx ├── Purchases - Home A.xlsx ├── Purchases - Home B.xlsx └── sample_data.json /README.md: -------------------------------------------------------------------------------- 1 | # Python-Automation 2 | Scripts used in python automation mini series on my youtube 3 | -------------------------------------------------------------------------------- /Remote Work Series/AutomateRemoteWork_spreadsheets.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import plotly.express as px 3 | 4 | excel_book_1_relative_path = 'Purchases - Home B.xlsx' 5 | excel_book_prices = 'PriceBook.xlsx' 6 | 7 | df_prices = pd.read_excel(excel_book_prices) 8 | df_home_1 = pd.read_excel(excel_book_1_relative_path) 9 | 10 | #print(df_prices, df_home_1) 11 | 12 | df_total = df_home_1.merge(df_prices, on='ID') 13 | 14 | df_total['Total Price'] = df_total['PURCHASED AMOUNT'] * df_total['Price'] 15 | 16 | #print(df_total) 17 | 18 | fig = px.pie(df_total[['MATERIAL', 'Total Price']], values='Total Price', names='MATERIAL') 19 | fig.show() 20 | -------------------------------------------------------------------------------- /Remote Work Series/RemoteWorkerAutomation-Websites.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from bs4 import BeautifulSoup 3 | 4 | from selenium import webdriver 5 | 6 | url = 'https://www.derricksherrill.com' 7 | response = requests.get(url) 8 | print(response.status_code) 9 | print(response.text) 10 | 11 | soup = BeautifulSoup(response.text, 'html.parser') 12 | print(soup.find_all('a')[1:5:1]) 13 | 14 | driver = webdriver.Chrome('./chromedriver') 15 | url_to_search = 'https://www.gamestop.com/video-games/switch/consoles/products/nintendo-switch-with-gray-joy-con/11095821.html' 16 | 17 | driver.get(url_to_search) 18 | 19 | content = driver.find_element_by_xpath('//*[@id="primary-details"]/div[4]/div[12]/div[3]/div/div[1]/button') 20 | print(content.text) 21 | -------------------------------------------------------------------------------- /Remote Work Series/RemoteWorkerAutomation_files.py: -------------------------------------------------------------------------------- 1 | import os 2 | from datetime import date 3 | import pandas as pd 4 | 5 | data_location = 'Docs/Employee Receipts/' 6 | file_list = [] 7 | for file in os.listdir(data_location): 8 | file_list.append(file) 9 | 10 | data = {'file_names' : file_list } 11 | file_df = pd.DataFrame(data) 12 | new_file_directory = 'Docs/Processed Receipts/' 13 | today = date.today() 14 | #file_df.to_excel(new_file_directory + 'receipts_sum -' + str(today) + '.xlsx' ) 15 | 16 | for file in os.listdir(data_location): 17 | os.rename(data_location + file, new_file_directory + file ) 18 | 19 | 20 | string_to_find = 'Derrick' 21 | directory_to_search = 'Docs/Processed Receipts/' 22 | derrick_docs = [] 23 | for file in os.listdir(directory_to_search): 24 | with open(directory_to_search + file) as f: 25 | if string_to_find in f.read(): 26 | derrick_docs.append(file) 27 | 28 | print(derrick_docs) 29 | -------------------------------------------------------------------------------- /Remote Work Series/api_automate.py: -------------------------------------------------------------------------------- 1 | import json 2 | import requests 3 | 4 | # Simple get request 5 | #response = requests.get( 'https://26607.wayscript.io/' ) 6 | #print(response.text) 7 | 8 | # get request using a token 9 | calendly_api_key = 'HBFMJLNOFRRIMSDJCOXDXSH4SOVKLBN2' 10 | headers = { 11 | "X-TOKEN" : calendly_api_key 12 | } 13 | response = requests.get( 'https://calendly.com/api/v1/users/me/event_types', 14 | headers=headers) 15 | 16 | print(response.json()) 17 | 18 | print( response.json().get('data')[0].get( 'id' )) 19 | 20 | 21 | 22 | # Get requests using a python library 23 | #from alpha_vantage.timeseries import TimeSeries 24 | #ts = TimeSeries(key='RNZPXZ6Q9FEFMEHM',output_format='pandas') 25 | #data, meta_data = ts.get_intraday(symbol='MSFT',interval='1min', outputsize='full') 26 | #print(data) 27 | 28 | 29 | 30 | # Get request to pull data, convert to JSON. 31 | # data_to_use = requests.get('https://26607.wayscript.io/time-series-data') 32 | # data_to_use = data_to_use.json() 33 | 34 | ''' 35 | # Post Request to use Machine Learning 36 | headers = { 'X-Time-Door-Key' : 'bf60f73d-fe59-4ccd-ba42-ecb5766ca1dc', 37 | 'Accept' : 'application/json', 38 | 'Content-Type' : 'application/json' } 39 | 40 | url_base = 'https://api.timedoor.io' 41 | 42 | r = requests.post( url_base + '/invocation/auto-arima', 43 | data = open('sample_data.json', 'rb'), 44 | headers = headers) 45 | 46 | print(r.text) 47 | ''' 48 | -------------------------------------------------------------------------------- /Sample Data/PriceBook.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Derrick-Sherrill/Python-Automation/6a920fe91c228e70c1e91208d929e3353734b82e/Sample Data/PriceBook.xlsx -------------------------------------------------------------------------------- /Sample Data/Purchases - Home A.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Derrick-Sherrill/Python-Automation/6a920fe91c228e70c1e91208d929e3353734b82e/Sample Data/Purchases - Home A.xlsx -------------------------------------------------------------------------------- /Sample Data/Purchases - Home B.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Derrick-Sherrill/Python-Automation/6a920fe91c228e70c1e91208d929e3353734b82e/Sample Data/Purchases - Home B.xlsx -------------------------------------------------------------------------------- /Sample Data/sample_data.json: -------------------------------------------------------------------------------- 1 | {"stepwise":true,"approximation":true,"non_stationary":true,"seasonal":true,"ic":"aicc","box_cox_lambda":null,"bias_adj":false,"unit_root_test":"kpss","seasonal_test":"ss","alpha":0.05,"ci_level":95,"horizon":10,"reproduction":false,"precision":{"digits":4,"method":"significant"},"time_series":[{"data":{"2020-01-01T00:00:00Z":28.0137,"2020-01-01T00:00:01Z":27.8591,"2020-01-01T00:00:02Z":27.6281,"2020-01-01T00:00:03Z":27.0703,"2020-01-01T00:00:04Z":25.7454,"2020-01-01T00:00:05Z":27.0635,"2020-01-01T00:00:06Z":27.9731,"2020-01-01T00:00:07Z":28.1618,"2020-01-01T00:00:08Z":29.5978,"2020-01-01T00:00:09Z":30.9978,"2020-01-01T00:00:10Z":31.0237,"2020-01-01T00:00:11Z":31.6535,"2020-01-01T00:00:12Z":32.0346,"2020-01-01T00:00:13Z":31.8492,"2020-01-01T00:00:14Z":32.3419,"2020-01-01T00:00:15Z":32.0351,"2020-01-01T00:00:16Z":30.7687,"2020-01-01T00:00:17Z":30.374,"2020-01-01T00:00:18Z":28.1942,"2020-01-01T00:00:19Z":25.9453,"2020-01-01T00:00:20Z":23.6843,"2020-01-01T00:00:21Z":21.943,"2020-01-01T00:00:22Z":20.309,"2020-01-01T00:00:23Z":19.3427,"2020-01-01T00:00:24Z":19.3478,"2020-01-01T00:00:25Z":19.7972,"2020-01-01T00:00:26Z":21.2299,"2020-01-01T00:00:27Z":22.4813,"2020-01-01T00:00:28Z":23.2128,"2020-01-01T00:00:29Z":22.7081,"2020-01-01T00:00:30Z":23.1786,"2020-01-01T00:00:31Z":22.805,"2020-01-01T00:00:32Z":23.4281,"2020-01-01T00:00:33Z":24.5025,"2020-01-01T00:00:34Z":24.213,"2020-01-01T00:00:35Z":23.3072,"2020-01-01T00:00:36Z":23.7229,"2020-01-01T00:00:37Z":23.1353,"2020-01-01T00:00:38Z":24.0197,"2020-01-01T00:00:39Z":23.3354,"2020-01-01T00:00:40Z":24.171,"2020-01-01T00:00:41Z":23.8188,"2020-01-01T00:00:42Z":24.6172,"2020-01-01T00:00:43Z":24.2777,"2020-01-01T00:00:44Z":24.2283,"2020-01-01T00:00:45Z":25.1955,"2020-01-01T00:00:46Z":26.4958,"2020-01-01T00:00:47Z":28.3069,"2020-01-01T00:00:48Z":29.7687,"2020-01-01T00:00:49Z":30.9865,"2020-01-01T00:00:50Z":29.7695,"2020-01-01T00:00:51Z":30.1204,"2020-01-01T00:00:52Z":31.742,"2020-01-01T00:00:53Z":34.6089,"2020-01-01T00:00:54Z":36.054,"2020-01-01T00:00:55Z":36.3756,"2020-01-01T00:00:56Z":37.36,"2020-01-01T00:00:57Z":38.1193,"2020-01-01T00:00:58Z":38.5563,"2020-01-01T00:00:59Z":40.6662,"2020-01-01T00:01:00Z":42.6862,"2020-01-01T00:01:01Z":45.0665,"2020-01-01T00:01:02Z":46.3616,"2020-01-01T00:01:03Z":46.8506,"2020-01-01T00:01:04Z":47.7675,"2020-01-01T00:01:05Z":47.6054,"2020-01-01T00:01:06Z":46.2565,"2020-01-01T00:01:07Z":45.536,"2020-01-01T00:01:08Z":46.3415,"2020-01-01T00:01:09Z":48.0423,"2020-01-01T00:01:10Z":50.8812,"2020-01-01T00:01:11Z":52.6965,"2020-01-01T00:01:12Z":54.7823,"2020-01-01T00:01:13Z":53.512,"2020-01-01T00:01:14Z":53.2565,"2020-01-01T00:01:15Z":53.0911,"2020-01-01T00:01:16Z":52.4152,"2020-01-01T00:01:17Z":51.8234,"2020-01-01T00:01:18Z":50.2512,"2020-01-01T00:01:19Z":51.0036,"2020-01-01T00:01:20Z":51.9257,"2020-01-01T00:01:21Z":52.5759,"2020-01-01T00:01:22Z":54.1171,"2020-01-01T00:01:23Z":55.4398,"2020-01-01T00:01:24Z":55.5233,"2020-01-01T00:01:25Z":53.8893,"2020-01-01T00:01:26Z":52.8306,"2020-01-01T00:01:27Z":52.2715,"2020-01-01T00:01:28Z":51.0688,"2020-01-01T00:01:29Z":51.6046,"2020-01-01T00:01:30Z":51.6625,"2020-01-01T00:01:31Z":51.1545,"2020-01-01T00:01:32Z":50.4331,"2020-01-01T00:01:33Z":49.8225,"2020-01-01T00:01:34Z":47.5345,"2020-01-01T00:01:35Z":48.5842,"2020-01-01T00:01:36Z":49.3886,"2020-01-01T00:01:37Z":50.4767,"2020-01-01T00:01:38Z":49.5141,"2020-01-01T00:01:39Z":50.3534},"imputation":{"method":"linear","ma_window_size":10}}]} 2 | --------------------------------------------------------------------------------