Skip to content

Instantly share code, notes, and snippets.

@Miladiouss
Last active October 25, 2019 19:38
Show Gist options
  • Save Miladiouss/332b21e3c9d82ca2085b1396641cc80d to your computer and use it in GitHub Desktop.
Save Miladiouss/332b21e3c9d82ca2085b1396641cc80d to your computer and use it in GitHub Desktop.
Usual imports and function for an IPython / Jupyter environment, specially for data science (e.g. matplotlib, numpy, time, ...).
# https://gist.github.com/Miladiouss/332b21e3c9d82ca2085b1396641cc80d
#-----------------------------------------------------------
# IPython
from IPython.core.interactiveshell import InteractiveShell
from IPython.display import clear_output
InteractiveShell.ast_node_interactivity = "all"
from IPython import display
#-----------------------------------------------------------
# Scientific
import pandas as pd
import numpy as np
ln = np.log
pi = np.pi
# import scipy as sp
# import sklearn as sk
# import numba as nb
#-----------------------------------------------------------
# System and File Management
import os
import sys
# import subprocess
# import gc
# import json
# import requests
# import shutil
# import h5py
#-----------------------------------------------------------
# Time
import time
from time import sleep
from datetime import datetime
timeFormat = '%a %b %d %Y at %H:%M:%S'
import socket
deviceName = socket.gethostname()
import getpass
userName = getpass.getuser()
def printStamp(preText = ''):
t1 = datetime.now()
print(preText + t1.strftime(timeFormat) + ' on ' + deviceName + ' by ' + userName)
return t1, deviceName, userName
_ = printStamp()
print("Python Path:", sys.executable)
#-----------------------------------------------------------
# Plotting
import matplotlib.pyplot as plt
#%matplotlib inline
%matplotlib notebook
#-----------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment