if I supply ("pandas", "pd"), is it possible to obtain import pandas as pd programatically?
I do know that I can do:
import importlib
pd = importlib.import_module('pandas')
But, can I supply the pd somehow as a string as well?
Technically, yes, and in more than way:
locals()['pd'] = importlib.import_module('pandas')
Of course, it rather bad practice.
try…except to handle the case of missing module?