Created
April 1, 2018 20:25
-
-
Save ryo1kato/3bde54f929fd4bbeeac61db586eaefb3 to your computer and use it in GitHub Desktop.
ipython autoload
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 sys, os, re | |
class AutoLoader(): | |
def __init__(self, nickname, modulename): | |
self.nickname = nickname | |
self.modulename = modulename | |
def __getattr__(self, methodname): | |
g = globals() | |
g[self.nickname] = __import__(self.modulename) | |
return getattr(g[self.nickname], methodname) | |
pd = AutoLoader('pd', 'pandas') | |
np = AutoLoader('np', 'numpy') | |
plt = AutoLoader('plt', 'matplotlib.pyplot') | |
sns = AutoLoader('sns', 'seaborn') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment