Skip to content

Instantly share code, notes, and snippets.

@jgarciabu
jgarciabu / First and Last Ex 12.py
Created July 31, 2017 20:50
First and Last Ex 12
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Write a program that takes a list of numbers (for example,
a = [5, 10, 15, 20, 25]) and makes a new list of only the first and last
elements of the given list. For practice, write this code inside a function.
@author: Jeff Garcia
"""
userlist = input("Please enter a list of numbers separated by a single space:")
@jgarciabu
jgarciabu / Ex 13 Fibonacci.py
Created August 1, 2017 13:48
Ex 13 Fibonacci
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Write a program that asks the user how many Fibonnaci numbers to generate and
then generates them. Take this opportunity to think about how you can use
functions. Make sure to ask the user to enter the number of numbers in the
sequence to generate.(Hint: The Fibonnaci seqence is a sequence of numbers
where the next number in the sequence is the sum of the previous two numbers
in the sequence. The sequence looks like this: 1, 1, 2, 3, 5, 8, 13, …)
@jgarciabu
jgarciabu / Ex 14 List Remove Duplicates.py
Last active August 9, 2017 19:01
Ex 14 List Remove Duplicates.py
# -*- coding: utf-8 -*-
"""
Write a program (function!) that takes a list and returns a new list that
contains all the elements of the first list minus all the duplicates.
Extras:
Write two different functions to do this - one using a loop and constructing a
list, and another using sets.
Go back and do Exercise 5 using sets, and write the solution for that in a
@jgarciabu
jgarciabu / Ex 15 List Reverse.py
Created August 9, 2017 19:47
Ex 15 List Reverse
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Write a program (using functions!) that asks the user for a long string
containing multiple words. Print back to the user the same string, except with
the words in backwards order. For example, say I type the string:
My name is Michele
Then I would see the string:
@jgarciabu
jgarciabu / InvoiceProcessingScriptShareable.R
Created August 30, 2017 22:23
This R script uses dplyr and RODBC to combine individual CSVs into one dataframe that is then uploaded into a Azure SQL database. This cuts down manual processing significantly. Sometimes I'll get 10 or 12 individual csvs and this script frees me up to focus on other processes and tasks.
library(plyr)
library(dplyr)
library(stringr)
library(RODBC)
#========================================
#Make sure working directory is new invoice folder in Dropbox
#Names of all files put in list to feed to merge code
filenames <- list.files()
@jgarciabu
jgarciabu / IBSBwithExceptionHandlingShareable.py
Created August 30, 2017 23:03
Python Selenium Bot used to create new mobile banking accounts for new consultants
from selenium import webdriver
import csv
import getpass
# create new instance of Firefox driver
browser = webdriver.Firefox()
# go to First Ipswich Bank website
browser.get("https://ssl.selectpayment.com/mp/fnbicom/login/page.aspx")
# Fill out login credentials (username, password, company name)
@jgarciabu
jgarciabu / gui_search.py
Created October 5, 2018 14:24
Directory Search Tool (With GUI)
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 27 14:03:28 2018
@author: jeffrey.garcia
"""
import wx
import pandas as pd
import os
@jgarciabu
jgarciabu / filescan.py
Created October 5, 2018 14:30
File scan tool to report file metadata (number of columns, column names, filename, etc)
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 8 13:57:08 2018
@author: jeffrey.garcia
"""
import pandas as pd
import os
import inspect; os.path
@jgarciabu
jgarciabu / master_file_cleanup.py
Created October 5, 2018 14:32
Remove rows from file that cause failure in processing
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 18 09:05:18 2018
@author: jeffrey.garcia
"""
import pandas as pd
import os
import inspect; os.path
@jgarciabu
jgarciabu / ml_automation.py
Created October 10, 2018 19:49
Code lib created to house all functions necessary to process data for this use case.
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 18 11:56:27 2018
@author: jeffrey.garcia
"""
import pandas as pd
import numpy as np
import csv