Skip to content

Instantly share code, notes, and snippets.

View Den1al's full-sized avatar
🎯
Focusing

Den1al Den1al

🎯
Focusing
View GitHub Profile
@Den1al
Den1al / aiohttp-example.py
Last active June 22, 2023 12:53
concurrent http requests with aiohttp
# author: @Daniel_Abeles
# date: 18/12/2017
import asyncio
from aiohttp import ClientSession
from timeit import default_timer
import async_timeout
async def fetch_all(urls: list):
@Den1al
Den1al / pandas-http-headers.py
Last active February 13, 2018 17:02
Working with HTTP Headers in Pandas can be tricky, this snippet usually works for me to handle that task.
# author: @Daniel_Abeles
# date: 10/05/2017
import numpy as np
import pandas as pd
class Headers(object):
''' Represents a header list '''
__slots__ = ['_headers', '_key']
@Den1al
Den1al / mysql-pandas-import.py
Last active December 14, 2017 15:57 — forked from stefanthoss/mysql-pandas-import.py
Import data from a MySQL database table into a Pandas DataFrame using the pymysql package.
import pandas as pd
import pymysql
from sqlalchemy import create_engine
engine = create_engine('mysql+pymysql://<user>:<password>@<host>:<port>/<dbname>')
df = pd.read_sql_query('SELECT * FROM table', engine)
df.head()