Skip to content

Instantly share code, notes, and snippets.

import logging
logger = logging.getLogger(__name__)
def log_decorator(funk):
def wrapper(data, **kwargs):
before = data.shape[0]
data = funk(data, **kwargs)
after = data.shape[0]
logger.info("Excluded {} rows, remaining {}".format(before - after, after))
return data
@elena-roff
elena-roff / setup.py
Created July 24, 2018 11:20
Working with data: run tests and coverage
import os
import unittest
import shutil
from setuptools import setup
from setuptools import Command
from dashboard import __version__
try:
import coverage
except ImportError:
@elena-roff
elena-roff / fetch_data_to_csv.py
Last active July 24, 2018 09:49
Working with data: Useful code chunks
#!/usr/bin/env python3
""" Script to fetch the data from the server and store in a csv file.
ARGS:
- SQL query to parse.
- filename to store the data to in the csv format.
OUTPUT:
- csv file with the data."""