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
set backspace=2 | |
set autoindent | |
set smartindent | |
set expandtab | |
set et | |
set tabstop=4 | |
set shiftwidth=4 | |
set showmatch | |
set ignorecase | |
set incsearch |
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
def reduce_mem_usage(df): | |
start_mem = df.memory_usage().sum() / 1024**2 | |
print('Memory usage of dataframe is {:.2f} MB'.format(start_mem)) | |
for col in df.columns: | |
col_type = df[col].dtype | |
if col_type != object: | |
c_min = df[col].min() | |
c_max = df[col].max() | |
if str(col_type)[:3] == 'int': |
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
FROM python:3.7 | |
ENV PYTHONUNBUFFERED 1 | |
ENV PIPENV_VENV_IN_PROJECT 1 | |
RUN mkdir /code | |
WORKDIR /code | |
RUN pip install -U pip && \ | |
pip install pipenv |
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
version: "3" | |
services: | |
web: | |
build: . | |
command: python manage.py runserver 0.0.0.0:8000 | |
volumes: | |
- .:/code | |
ports: | |
- "8000:8000" |
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
from sklearn.externals import joblib | |
with joblib.parallel_backend('dask'): | |
grid_search.fit(X, y) |
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 pandas as pd | |
pd.set_option('display.max_columns', None) # or 1000 | |
pd.set_option('display.max_rows', 100) # or 1000 | |
pd.set_option('display.max_colwidth', -1) # or 199 | |
import pandas_explode | |
pandas_explode.patch() |
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 | |
os.environ["CUDA_VISIBLE_DEVICES"]="2" | |
os.environ['CUDA_VISIBLE_DEVICES'] |
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 requests | |
from bs4 import BeautifulSoup as bs | |
def _word_to_int(x): | |
if x.isdigit(): | |
return int(x) | |
if 'K' in x: | |
return int(float(x[:-1]) * 1000) | |
def get_follow_counts(username): |
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
def plot_multi(data, cols=None, spacing=.1, **kwargs): | |
from pandas import plotting | |
# Get default color style from pandas - can be changed to any other color list | |
if cols is None: cols = data.columns | |
if len(cols) == 0: return | |
# colors = getattr(getattr(plotting, '_style'), '_get_standard_colors')(num_colors=len(cols)) | |
# colors = [rand_color.generate() for _ in range(len(cols))] | |
# colors = rand_color.generate(hue="blue", count=len(cols)) |
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
#! /bin/bash | |
# | |
# Copyright 2014 Lucy Park | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |