Skip to content

Instantly share code, notes, and snippets.

View alecsharpie's full-sized avatar
😄

Alec Sharp alecsharpie

😄
View GitHub Profile
# https://stackoverflow.com/questions/51122413/regex-for-extracting-all-complex-dates-formats-from-a-string-in-python
import re
import calendar
class DateRegex:
def __init__(self):
# create regex helper strings
full_months = [month for month in calendar.month_name if month]
short_months = [d[:3] for d in full_months]
@alecsharpie
alecsharpie / SETUP_DAY.md
Created February 25, 2021 06:43
Starting my coding journey...
@alecsharpie
alecsharpie / Capitaliser.R
Created May 18, 2020 09:18
Make the first letter upper case and the rest lower case. (for: multiple strings in a list, multiple words in a string)
# Make first letter of each word capital and the rest lower case
# loop through each row in your column
for (i in 1:nrow(dataframe)) {
#split the string into words and save as a vector
c <- unlist(str_split(dataframe$column[i], " "))
#loop through the vector you just created
for (j in 1:length(c)) {