Skip to content

Instantly share code, notes, and snippets.

from airflow import DAG
from datetime import datetime, timedelta
from airflow.providers.postgres.operators.postgres import PostgresOperator
default_args = {
'owner': 'airflow',
'retries': 1,
'retry_delay': timedelta(minutes=5),
'start_date': datetime(2024, 1, 1),
}
@joelsewhere
joelsewhere / nyc_bedbugs.py
Created October 4, 2023 18:22
Visualize Bedbug Reports by Year and Month
from requests import get
from io import StringIO
import pandas as pd
import matplotlib.pyplot as plt
url = 'https://data.cityofnewyork.us/api/views/wz6d-d3jb/rows.csv?accessType=DOWNLOAD'
response = get(url)
io = StringIO(response.content.decode('utf-8'))
df = pd.read_csv(io)
df = df.assign(filing_date=pd.to_datetime(df['Filing Date']))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[{"type": "section", "text": {"type": "mrkdwn", "text": "Happy {}! :wave:"}}, {"type": "section", "text": {"type": "mrkdwn", "text": "Here is your <{}|warmup> for today."}}]
[
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@channel Happy {}! :wave:"
}
},
{
"type": "section",
[
{
"type": "section",
"text": { "type": "mrkdwn", "text": "@channel Happy {}! :wave:" }
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "_Respond to be counted in today's attendance_ :arrow_down:"
[
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@channel Happy {}! :wave:"
}
},
{
"type": "section",
[{"Image": "https://en.wikipedia.org/wiki/File:Richard_Shelby,_official_portrait,_112th_Congress_(cropped).jpg", "Senator": "Richard Shelby", "Party": "Republican", "Born": "May 6, 1934 (age 85)", "Occupation(s)": "Lawyer", "Previous\noffice(s)": "U.S. House\nAlabama Senate", "Assumed office": "January 3, 1987", "Term up": "2022", "Residence": "Tuscaloosa[1]", "state": "Alabama"}, {"Image": "https://en.wikipedia.org/wiki/File:Senator_Doug_Jones_official_photo_(cropped_2).jpg", "Senator": "Doug Jones[d]", "Party": "Democratic", "Born": "May 4, 1954 (age 65)", "Occupation(s)": "Lawyer", "Previous\noffice(s)": "Staff counsel, U.S. Senate Judiciary Committee\nU.S. Attorney for the Northern District of Alabama", "Assumed office": "January 3, 2018", "Term up": "2020", "Residence": "Birmingham[1]", "state": "Alabama"}, {"Image": "https://en.wikipedia.org/wiki/File:Lisa_Murkowski_official_photo_(cropped).jpg", "Senator": "Lisa Murkowski", "Party": "Republican", "Born": "May 22, 1957 (age 62)", "Occupation(s)": "Lawye
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 1.
Unnamed: 0,"Abingdon city, Illinois","Addieville village, Illinois","Addison village, Illinois","Adeline village, Illinois","Albany village, Illinois","Albers village, Illinois","Albion city, Illinois","Aledo city, Illinois","Alexis village, Illinois","Algonquin village, Illinois","Alhambra village, Illinois","Allendale village, Illinois","Allenville village, Illinois","Allerton village, Illinois","Alma village, Illinois","Alorton village, Illinois","Alpha village, Illinois","Alsey village, Illinois","Alsip village, Illinois","Altamont city, Illinois","Alton city, Illinois","Altona village, Illinois","Alto Pass village, Illinois","Alvan village, Illinois","Amboy city, Illinois","Anchor village, Illinois","Andalusia village, Illinois","Andover village, Illinois","Anna city, Illinois","Annawan town, Illinois","Antioch village, Illinois","Apple River village, Illinois","Arcola city, Illinois","Arenzville village, Illinois","Argenta village, Illinois","Arlington village, Illinois","Arlington Heights village, Illi
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.