Published using Google Docs
CheatSheet_Install_Import
Updated automatically every 5 minutes

INSTALL

stuff to install in your virtual environment

pip freeze -l to see what is already in there

install pip

Installs libraries for you

pip3 install requests

accessing APIs

pip3 install BeautifulSoup4

pip3 install pandas

pip3 install dateutils

pip3 install numpy

pip3 install jupyter

accessing iPython notebook

pip3 install selenium

pip3 install pg800

accessing psql database

pip3 install twython

accessing a twitter API


IMPORT

import pg8000

connect =pg8000.connect(database="yourdatabase")

connect =pg8000.connect(username= "your username", password="your password", database="yourdatabase")

for MAC

for Windows

from bs4 import BeautifulSoup

from urllib.requests import urlopen

from math import sqrt

import re

from collections import Counter

import pandas as pd

import matplotlib.pyplot as plt

from datetime import datetime

from datetime import date

import dateutil.parser

import random

random.choice(wheretochoosefrom) chooses randomly from wheretochoosefrom

import numpy as np

performs basic calculations as

np.mean()

np.median()

and finds specified elements

np.where