This file contains 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
import csv | |
import calendar | |
from collections import Counter | |
import matplotlib.pyplot as plt | |
# set up empty Counter objectS | |
months_counter = Counter() | |
# open and read CSV | |
with open("dashboard-export.csv") as f: |
This file contains 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
import re | |
from collections import Counter | |
def main(): | |
print_header() | |
user_file = input("Enter the absolute path for your TXT file:\n\n") | |
print() | |
wc = get_word_counter(user_file) | |
print() | |
get_count_of_word(wc) |
This file contains 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
import csv | |
import sys | |
from collections import Counter, defaultdict | |
from datetime import datetime as dt | |
from decimal import Decimal | |
from time import sleep | |
# First import your purchases data from Amazon.com and store CSV | |
# file in the same directory as this program. | |
# Column names in CSV file for reference |
This file contains 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
# Auburn, WA Police Data CSV available at: https://data.auburnwa.gov/ | |
import csv | |
import sys | |
from collections import Counter | |
# CSV headers for reference | |
# [0] CASENUMBER | |
# [1] OFFENSE | |
# [2] OFFENSETYPE |
This file contains 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
# Auburn, WA Police Data CSV available at: https://data.auburnwa.gov/ | |
import csv | |
import sys | |
from collections import Counter | |
from datetime import datetime as dt | |
# Rows in CSV file for reference: | |
# [0] CASENUMBER | |
# [1] OFFENSE |
This file contains 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
import random | |
import smtplib | |
import ssl | |
import sys | |
import textwrap | |
from email.mime.text import MIMEText | |
from datetime import datetime | |
def main(): | |
print_header() |
This file contains 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
import sys | |
from string import punctuation | |
import json | |
from nltk.corpus import cmudict | |
# load dict of words in corpus but not in cmudict | |
with open("missing_words.json") as f: | |
missing_words = json.load(f) | |
cmudict = cmudict.dict() |
This file contains 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
# NLTK is a suite of libraries for working with human language data: http://www.nltk.org | |
# NLTK allows us to access the Carnegie Mellon University Prounouncing Dictionary (cmudict) | |
# cmudict is a corpus that contains almost 125,000 words mapped to their pronunciations. | |
# This tiny app was inspired by Lee Vaughn's Impractical Python Projects | |
import sys | |
from string import punctuation | |
from nltk.corpus import cmudict | |
# load corpus and build dictionary |
This file contains 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
import os | |
def load(name): | |
""" | |
This method creates and loads a new journal. | |
:param name: This base name of the journal to load. | |
:return: A new journal data structure populated with file data. | |
""" | |
data = [] | |
filename = get_full_pathname(name) |
This file contains 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
# Exercise completed as part of Erin Allard's Lynda.com course, | |
# 'Python Data Structures: Stacks, Queues, and Deques' | |
class Deque: | |
"""An ADT that resembles both a Stack (LIFO) and a Queue (FIFO). | |
Items in a deque can be added to and removed from both the back | |
and front. | |
Don't reinvent the wheel. More simply, from collections import deque | |
https://docs.python.org/3/library/collections.html#collections.deque |