Skip to content

Instantly share code, notes, and snippets.

View monipip3's full-sized avatar

Monica Puerto monipip3

View GitHub Profile
@monipip3
monipip3 / bls_gov.R
Created October 28, 2019 03:01
Webscraping all the Bureau Labor Stats tables and joining them into an R data frame
library(purrr)
setwd("~/Desktop")
library(rvest)
if(!file.exists("./data/labor_data")) {dir.create("./data/labor_data")}
suppressPackageStartupMessages(library(lubridate))
suppressPackageStartupMessages(library(rvest))
#save url into a variable
url <- "https://www.bls.gov/lau/#tables"
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 1 11:28:12 2019
@author: mpuerto
"""
#This file will read a CSV, understsand your data types, to then create a SQL create table statement and populate it via your S3 file
import csv, ast, psycopg2, os
@monipip3
monipip3 / international_womens_day.txt
Created March 7, 2019 18:20
Events in DC for International Womens Day
Some events in DC for celebrating Women’s International Day tomorrow & this weekend
https://www.internationalwomensday.com/Activity/13460/General-Assembly-Women-in-Tech-Breakfast-Building-Inclusive-Teams-for-Success (tomorrow morning breakfast)
https://www.internationalwomensday.com/Activity/13758/Women-s-Day-Happy-Hour (tomorrow happy hour)
https://www.internationalwomensday.com/Activity/13445/Women-in-the-Arts-Pop-up-2019 (art tomorrow / weekend )
https://www.internationalwomensday.com/Activity/14009/Roaring-20s-Meet-Up (tomorrow happy hour)
import pandas as pd
import nltk
from nltk.corpus import stopwords
from collections import OrderedDict
from nltk.tokenize import RegexpTokenizer
nltk.download('stopwords')
df = pd.read_csv('5StarReviews.csv')
#crear una función llamada bigrams que saca "bigrams" utilizando las funciónes de NLTK para extraer las pares de palabras mas mencionadas
room = "clean"
def clean_room(room):
"""
Tells the user an outcome, given the state of the room.
Args:
variable: str(state of the room)
Returns: str(outcome of the situation)
"""
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import pandas as pd
# use creds to create a client to interact with the Google Drive API
scope = ['https://spreadsheets.google.com/feeds']
creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
client = gspread.authorize(creds)
@monipip3
monipip3 / pbjwhile.py
Created January 9, 2018 02:25
PBJ sandwich using a while loop
bread = 12
peanut_butter = 10
jelly = 14
i = min(bread/2, peanut_butter, jelly)
while i > 0:
print "I can make {0} sandwiches".format(i)
bread = bread - 2
jelly = jelly - 1
peanut_butter = peanut_butter - 1
i = i -1
@monipip3
monipip3 / pbj.py
Last active January 9, 2018 01:12
Peanut Butter and Jelly Sandwich with if and else
bread = 10
peanut_butter = 20
jelly = 30
if bread > 1 and peanut_butter >= 1 and jelly >= 1:
sandwiches = bread/2
print "I can make {0} PBJ sandwiches today.".format(sandwiches)
elif bread % 2 and peanut_butter >=1 and jelly >= 1:
print "I can make an open face sandwich"
elif bread > 1 and peanut_butter >= 1 and jelly == 0:
bpsandwiches = min(bread/2,peanut_butter)
for bottles in range (1,100):
print "{0} bottles of beer on the wall, {0} bottles of beer... \n If one of those bottles should happen to fall, {1} bottles of beer on the wall".format(100 - bottles, 99 - bottles)